Fix wrong type definition on lean function parameter (#35916)

* Fix wrong type definition on lean function parameter

* Update the parameter type in lean function
This commit is contained in:
Grimmer 2019-06-04 07:30:55 +08:00 committed by Andrew Casey
parent 2605bf19cb
commit 1cdaa0a699
2 changed files with 9 additions and 2 deletions

View File

@ -24,6 +24,7 @@
// Erik Lopez <https://github.com/niuware>
// Vlad Melnik <https://github.com/vladmel1234>
// Jarom Loveridge <https://github.com/jloveridge>
// Grimmer Kang <https://github.com/grimmer0125>
// 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<any> & QueryHelpers;
lean(bool?: boolean | object): Query<any> & QueryHelpers;
/** Specifies the maximum number of documents the query will return. Cannot be used with distinct() */
limit(val: number): this;

View File

@ -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