Saturday 29 April 2017

Clean objects in model to reflect schema with Mongoose

I am using Mongoose in my Node.js app.

I have defined some schemes and created some objects, but I have changed the schemes since the objects were created.

Is it possible to clean all objects in a model such that the fields not present in the schema are removed from the objects?

I could alternatively remove all objects and create them again, but since I already have quite many objects, I would rather find a good solution to clean them.



via Jamgreen

No comments:

Post a Comment