diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 9f909c4695..9c003cb666 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -24,6 +24,7 @@ // Erik Lopez // Vlad Melnik // Jarom Loveridge +// Grimmer Kang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1935,9 +1936,9 @@ declare module "mongoose" { * Documents returned from queries with the lean option enabled are plain * javascript objects, not MongooseDocuments. They have no save method, * getters/setters or other Mongoose magic applied. - * @param bool defaults to true + * @param {Boolean|Object} bool defaults to true */ - lean(bool?: boolean): Query & QueryHelpers; + lean(bool?: boolean | object): Query & QueryHelpers; /** Specifies the maximum number of documents the query will return. Cannot be used with distinct() */ limit(val: number): this; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 55faba9f88..d3688747b0 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -1199,6 +1199,12 @@ query. sort('-occupation'). select('name occupation'). exec(cb).then(cb).catch(cb); +/** + * https://mongoosejs.com/docs/api.html#query_Query-lean + */ +query.lean() // true +query.lean(false) +query.lean({}) /* * section schema/array.js