Interface VirtualOptions

Hierarchy

  • VirtualOptions

Indexable

[extra: string]: any

Properties

count?: boolean

Return the number of Documents found instead of the actual Documents

foreignField: string | ((this, doc) => string)

Which property(on the ref-Class) to match localField against

Type declaration

getters?: boolean

If you set this to true, Mongoose will call any custom getters you defined on this virtual.

Note: Copied from mongoose's "index.d.ts"#VirtualTypeOptions

justOne?: boolean

Return as One Document(true) or as Array(false)

limit?: number

Add a default limit to the populate() query.

Note: Copied from mongoose's "index.d.ts"#VirtualTypeOptions

localField: string | ((this, doc) => string)

Which property(on the current-Class) to match foreignField against

Type declaration

match?: FilterQuery<any> | ((doc, virtual?) => Record<string, any>)

Match Options

Type declaration

    • (doc, virtual?): Record<string, any>
    • Parameters

      Returns Record<string, any>

options?: mongoose.QueryOptions<unknown> & {
    match?: AnyObject;
}

Extra Query Options

Type declaration

perDocumentLimit?: number

For legacy reasons, limit with populate() may give incorrect results because it only executes a single query for every document being populated. If you set perDocumentLimit, Mongoose will ensure correct limit per document by executing a separate query for each document to populate(). For example, .find().populate({ path: 'test', perDocumentLimit: 2 }) will execute 2 additional queries if .find() returns 2 documents.

Note: Copied from mongoose's "index.d.ts"#VirtualTypeOptions

ref: NonNullable<string | AnyParamConstructor<any> | DeferredFunc<string | AnyParamConstructor<any> | DynamicStringFunc<any>>>

Reference another Document (Ref should be used as property type)

skip?: number

Add a default skip to the populate() query.

Note: Copied from mongoose's "index.d.ts"#VirtualTypeOptions

Generated using TypeDoc