MCPcopy
hub / github.com/Automattic/mongoose / _nextDoc

Function _nextDoc

lib/cursor/queryCursor.js:608–623  ·  view source on GitHub ↗
(ctx, doc, pop, callback)

Source from the content-addressed store, hash-verified

606 */
607
608function _nextDoc(ctx, doc, pop, callback) {
609 if (ctx.query._mongooseOptions.lean) {
610 return ctx.model.hooks.execPost('find', ctx.query, [[doc]]).then(() => callback(null, doc), err => callback(err));
611 }
612
613 const { model, _fields, _userProvidedFields, options } = ctx.query;
614 helpers.createModelAndInit(model, doc, _fields, _userProvidedFields, options, pop, (err, doc) => {
615 if (err != null) {
616 return callback(err);
617 }
618 if (options.session != null) {
619 doc.$session(options.session);
620 }
621 ctx.model.hooks.execPost('find', ctx.query, [[doc]]).then(() => callback(null, doc), err => callback(err));
622 });
623}
624
625/*!
626 * ignore

Callers 2

_nextFunction · 0.85
_populateBatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…