You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into an issue where the children documents were not being recognized and decrypted properly. The children are not in an array, and just a single sub-document.
I made sure to add the encryptedChildren plugin, but noticed that both of the children documents were not being decrypted after saving. All other functions of the plugin are working great however, and the children are being decrypted properly when the models are loaded.
Digging into it, I noticed that the decryptEmbeddedDocs() function was only responding to nested documents if the value for that path was an array at time of decryption.
I ran into an issue where the children documents were not being recognized and decrypted properly. The children are not in an array, and just a single sub-document.
I'm using Typegoose and Mongoose:
I made sure to add the encryptedChildren plugin, but noticed that both of the children documents were not being decrypted after saving. All other functions of the plugin are working great however, and the children are being decrypted properly when the models are loaded.
Digging into it, I noticed that the decryptEmbeddedDocs() function was only responding to nested documents if the value for that path was an array at time of decryption.
mongoose-encryption/lib/util/decryptEmbeddedDocs.js
Line 20 in 2b2fbe5
It looks like in your tests the children value is an array, and that's what is being tested against.
The text was updated successfully, but these errors were encountered: