I have a collection that holds documents that contains three fields: first_name, last_name, and age. I\'m trying to figure out what query in Mongoose I can use to do a bulk
I have released a small plugin for Mongoose that exposes a static upsertMany method to perform bulk upsert operations with a promise interface. This should provide a very clean way of doing bulk upserts with Mongoose, while retaining schema validation etc:
MyModel.upsertMany(items, ['matchField', 'other.nestedMatchField']);
You can find this plugin on npm or Github:
https://github.com/meanie/mongoose-upsert-many https://www.npmjs.com/package/@meanie/mongoose-upsert-many