diff --git a/src/fields/traverseFields.ts b/src/fields/traverseFields.ts index bd8a986ac2..1c0ed533a2 100644 --- a/src/fields/traverseFields.ts +++ b/src/fields/traverseFields.ts @@ -69,7 +69,7 @@ const traverseFields = (args: Arguments): void => { fields.forEach((field) => { const dataCopy = data; - if (operation === 'read' && field.hidden && typeof data[field.name] !== 'undefined' && !showHiddenFields) { + if (hook === 'afterRead' && field.hidden && typeof data[field.name] !== 'undefined' && !showHiddenFields) { delete data[field.name]; } diff --git a/src/utilities/removeInternalFields.ts b/src/utilities/removeInternalFields.ts index 2f6c32ab86..e98c2e9021 100644 --- a/src/utilities/removeInternalFields.ts +++ b/src/utilities/removeInternalFields.ts @@ -1,4 +1,4 @@ -const internalFields = ['_id', '__v', 'salt', 'hash', '_verificationToken']; +const internalFields = ['_id', '__v', 'salt', 'hash']; const removeInternalFields = (incomingDoc) => Object.entries(incomingDoc).reduce((newDoc, [key, val]) => { if (internalFields.indexOf(key) > -1) {