(ctx, doc, pop, callback)
| 606 | */ |
| 607 | |
| 608 | function _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 |
no outgoing calls
no test coverage detected
searching dependent graphs…