Document.prototype.execPopulate()
Parameters
- [callback] «Function» optional callback. If specified, a promise will not be returned
Returns:
- «Promise» promise that resolves to the document when population is done
Explicitly executes population and returns a promise. Useful for promises integration.
Example:
const promise = doc.
populate('company').
populate({
path: 'notes',
match: /airline/,
select: 'text',
model: 'modelName'
options: opts
}).
execPopulate();
// summary
doc.execPopulate().then(resolve, reject);
// you can also use doc.execPopulate(options) as a shorthand for // doc.populate(options).execPopulate()
Example:
const promise = doc.execPopulate({ path: ‘company’, select: ‘employees’ });
// summary promise.then(resolve,reject);
当前内容版权归 mongoosejs 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mongoosejs .