mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
[@types/mongoose] Add missing options?: mongodb.CollectionBulkWriteOptions to Model.bulkWrite (#38059)
* Update index.d.ts * Update mongoose-tests.ts * Update mongoose-tests.ts
This commit is contained in:
committed by
Ron Buckton
parent
3a47df29de
commit
c823c6e10e
Vendored
+4
@@ -29,6 +29,7 @@
|
||||
// Brian Chen <https://github.com/ToucheSir>
|
||||
// Boris Figovsky <https://github.com/borfig>
|
||||
// Simon Driscoll <https://github.com/dinodeSimon>
|
||||
// Anton Kenikh <https://github.com/anthony-kenikh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -2876,10 +2877,13 @@ declare module "mongoose" {
|
||||
* Mongoose will perform casting on all operations you provide.
|
||||
* This function does not trigger any middleware, not save() nor update(). If you need to trigger save() middleware for every document use create() instead.
|
||||
* @param writes Operations
|
||||
* @param options Optional settings. See https://mongoosejs.com/docs/api/model.html#model_Model.bulkWrite
|
||||
* @param cb callback
|
||||
* @return `BulkWriteOpResult` if the operation succeeds
|
||||
*/
|
||||
bulkWrite(writes: any[], cb?: (err: any, res: mongodb.BulkWriteOpResultObject) => void): Promise<mongodb.BulkWriteOpResultObject>;
|
||||
bulkWrite(writes: any[], options?: mongodb.CollectionBulkWriteOptions): Promise<mongodb.BulkWriteOpResultObject>;
|
||||
bulkWrite(writes: any[], options: mongodb.CollectionBulkWriteOptions, cb: (err: any, res: mongodb.BulkWriteOpResultObject) => void): void;
|
||||
|
||||
/**
|
||||
* Finds a single document by its _id field. findById(id) is almost*
|
||||
|
||||
@@ -778,8 +778,11 @@ MyModel.bulkWrite([{foo:'bar'}]).then(r => {
|
||||
console.log(r.deletedCount);
|
||||
});
|
||||
MyModel.bulkWrite([], (err, res) => {
|
||||
console.log(res.modifiedCount)
|
||||
})
|
||||
console.log(res.modifiedCount);
|
||||
});
|
||||
MyModel.bulkWrite([], { ordered: false }, (err, res) => {
|
||||
console.log(res.modifiedCount);
|
||||
});
|
||||
doc.populate('path');
|
||||
doc.populate({path: 'hello'});
|
||||
doc.populate('path', cb)
|
||||
|
||||
Reference in New Issue
Block a user