Open XDagging opened 9 months ago
Hi @XDagging thanks for the report. What version of Mongoose are you using? Are you using any other mongoose plugins?
I’m not sure I fully understand your scenario. Are you first adding the mongoose-encryption plugin to this collection now? (That’s what the migrateToA method expects)
On the other hand, if you already are using the mongoose-encryption plugin on this collection and are simply changing which fields are encrypted, you don’t need to run any special migration method. Rather, find and save each document to update them. https://github.com/joegoldbeck/mongoose-encryption?tab=readme-ov-file#changing-options
either way, “Model.find is not supported anymore” is a fairly surprising error! It’s been a while since I’ve used mongoose, but a quick check of the docs suggests that Model.find should still be a method. https://mongoosejs.com/docs/api/model.html#Model.find()
Is it possible that error is coming from another plugin?
Am also getting the same error were you able to fix it?
Am also getting the same error were you able to fix it?
No unfortunately. I lost some production data but yk you live and you learn. I switched away from mongoose to using something more like cryptr so this kind of thing can't happen again
so i changed the encryptedFields section and because of that, i need to migrate it (due to a preexisting collection. i look at the documentation and i find the migrateToA function. this function just plainly does not work.
it gives the error (Model.find is not supported anymore)
node version v20.11.0