Optional
countOptional
foreignThe foreign field to populate on if this is a populated virtual.
Optional
gettersIf you set this to true
, Mongoose will call any custom getters you defined on this virtual.
Optional
justBy default, a populated virtual is an array. If you set justOne
,
the populated virtual will be a single doc or null
.
Optional
limitAdd a default limit
to the populate()
query.
Optional
localThe local field to populate on if this is a populated virtual.
Optional
matchAdd an extra match condition to populate()
.
Optional
virtual: VirtualTypeOptions<HydratedDocType, DocType>Optional
Optional
optionsAdditional options like limit
and lean
.
Optional
match?: AnyObjectOptional
perFor 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.
Optional
refIf ref
is not nullish, this becomes a populated virtual.
Optional
skipAdd a default skip
to the populate()
query.
Generated using TypeDoc
If you set this to
true
,populate()
will set this virtual to the number of populated documents, as opposed to the documents themselves, usingQuery#countDocuments()
.