Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#49532 [mongoose] add missing option "optim…
Browse files Browse the repository at this point in the history
…isticConcurrency" to interface SchemaOptions by @jenoosia

Co-authored-by: Jensen Bryan Ching <jensen@stashaway.com>
  • Loading branch information
jenoosia and Jensen Bryan Ching authored Nov 27, 2020
1 parent 2725cd9 commit 663baa7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions types/mongoose/v4/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,12 @@ declare module "mongoose" {
* assigned is Date.
*/
timestamps?: any;
/**
* Defaults to false. Provides optimistic
* concurrency support for `save()`. `versionKey`
* must be set if this is true.
*/
optimisticConcurrency?: boolean;
}

/*
Expand Down
1 change: 1 addition & 0 deletions types/mongoose/v4/mongoose-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ new mongoose.Schema({ name: { type: String, validate: [
{ validator: () => {return true}, msg: 'uh oh' },
{ validator: () => {return true}, msg: 'failed' }
]}});
new mongoose.Schema({ status: String, photos: [String] }, { optimisticConcurrency: true });
animalSchema.statics.findByName = function(name: any, cb: any) {
return this.find({ name: new RegExp(name, 'i') }, cb);
};
Expand Down

0 comments on commit 663baa7

Please sign in to comment.