Changes
This commit is contained in:
8
node_modules/mongoose/lib/helpers/query/castUpdate.js
generated
vendored
8
node_modules/mongoose/lib/helpers/query/castUpdate.js
generated
vendored
@@ -105,6 +105,14 @@ module.exports = function castUpdate(schema, obj, options, context, filter) {
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(ret).length === 0 &&
|
||||
options.upsert &&
|
||||
Object.keys(filter).length > 0) {
|
||||
// Trick the driver into allowing empty upserts to work around
|
||||
// https://github.com/mongodb/node-mongodb-native/pull/2490
|
||||
return { $setOnInsert: filter };
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user