fix(mongoose): add arrayFilters to Model.findOneAndUpdate (#43062)

This commit is contained in:
Stephane Ruhlmann 2020-03-27 16:52:11 +01:00 committed by GitHub
parent d1581b6eeb
commit d0b79424bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -2391,6 +2391,10 @@ declare module "mongoose" {
before sending the update to the server.**/
omitUndefined?: boolean;
session?: ClientSession;
/**
* Only update elements that match the arrayFilters conditions in the document or documents that match the query conditions.
*/
arrayFilters?: { [key: string]: any }[];
}
interface QueryUpdateOptions extends ModelUpdateOptions {

View File

@ -1934,6 +1934,7 @@ MongoModel.findOneAndRemove();
MongoModel.findOneAndUpdate({}, {}, {}, cb);
MongoModel.findOneAndUpdate({}, {}, {});
MongoModel.findOneAndUpdate({}, {}, { upsert: true, new: true });
MongoModel.findOneAndUpdate({}, {}, { upsert: true, new: true, arrayFilters: [{ 'elem._id': 123 }] });
MongoModel.findOneAndUpdate({}, {}, cb);
MongoModel.findOneAndUpdate({}, {});
MongoModel.findOneAndUpdate();