mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Differentiate between model/document and query populate options (#35725)
This commit is contained in:
parent
11b03605ce
commit
7ff648e68b
11
types/mongoose/index.d.ts
vendored
11
types/mongoose/index.d.ts
vendored
@ -2060,7 +2060,7 @@ declare module "mongoose" {
|
||||
*/
|
||||
populate(path: string | any, select?: string | any, model?: any,
|
||||
match?: any, options?: any): this;
|
||||
populate(options: ModelPopulateOptions | ModelPopulateOptions[]): this;
|
||||
populate(options: QueryPopulateOptions | QueryPopulateOptions[]): this;
|
||||
|
||||
/**
|
||||
* Determines the MongoDB nodes from which to read.
|
||||
@ -3307,7 +3307,7 @@ declare module "mongoose" {
|
||||
session?: ClientSession | null;
|
||||
}
|
||||
|
||||
interface ModelPopulateOptions {
|
||||
interface QueryPopulateOptions {
|
||||
/** space delimited path(s) to populate */
|
||||
path: string;
|
||||
/** optional fields to select */
|
||||
@ -3319,7 +3319,12 @@ declare module "mongoose" {
|
||||
/** optional query options like sort, limit, etc */
|
||||
options?: any;
|
||||
/** deep populate */
|
||||
populate?: ModelPopulateOptions | ModelPopulateOptions[];
|
||||
populate?: QueryPopulateOptions | QueryPopulateOptions[];
|
||||
}
|
||||
|
||||
interface ModelPopulateOptions extends QueryPopulateOptions {
|
||||
/** optional, if true Mongoose will always set path to an array. Inferred from schema by default */
|
||||
justOne?: boolean;
|
||||
}
|
||||
|
||||
interface ModelUpdateOptions extends ModelOptions {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user