diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 50496fc9da..81974b2ee0 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mongoose 5.0.1 +// Type definitions for Mongoose 5.0.12 // Project: http://mongoosejs.com/ // Definitions by: horiuchi // sindrenm @@ -2608,10 +2608,18 @@ declare module "mongoose" { * because it only sends one operation to the server, rather than one for each * document. * This function does not trigger save middleware. + * @param docs Documents to insert. + * @param options Optional settings. + * @param options.ordered if true, will fail fast on the first error encountered. + * If false, will insert all the documents it can and report errors later. + * @param options.rawResult if false, the returned promise resolves to the documents that passed mongoose document validation. + * If `false`, will return the [raw result from the MongoDB driver](http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpCallback) + * with a `mongoose` property that contains `validationErrors` if this is an unordered `insertMany`. */ insertMany(docs: any[], callback?: (error: any, docs: T[]) => void): Promise; + insertMany(docs: any[], options?: { ordered?: boolean, rawResult?: boolean }, callback?: (error: any, docs: T[]) => void): Promise; insertMany(doc: any, callback?: (error: any, doc: T) => void): Promise; - insertMany(...docsWithCallback: any[]): Promise; + insertMany(doc: any, options?: { ordered?: boolean, rawResult?: boolean }, callback?: (error: any, doc: T) => void): Promise; /** * Executes a mapReduce command.