Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Automattic/mongoose
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 19, 2021
2 parents 03905c5 + 422620b commit 43b0cfa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/cursor/QueryCursor.js
Expand Up @@ -441,7 +441,7 @@ function _populateBatch() {

function _nextDoc(ctx, doc, pop, callback) {
if (ctx.query._mongooseOptions.lean) {
return ctx.model.hooks.execPost('find', ctx.query, [doc], err => {
return ctx.model.hooks.execPost('find', ctx.query, [[doc]], err => {
if (err != null) {
return callback(err);
}
Expand All @@ -453,7 +453,7 @@ function _nextDoc(ctx, doc, pop, callback) {
if (err != null) {
return callback(err);
}
ctx.model.hooks.execPost('find', ctx.query, [doc], err => {
ctx.model.hooks.execPost('find', ctx.query, [[doc]], err => {
if (err != null) {
return callback(err);
}
Expand Down
1 change: 0 additions & 1 deletion lib/document.js
Expand Up @@ -600,7 +600,6 @@ Document.prototype.$__init = function(doc, opts) {
this.constructor.emit('init', this);

this.$__._id = this._id;

return this;
};

Expand Down
4 changes: 2 additions & 2 deletions test/query.cursor.test.js
Expand Up @@ -692,8 +692,8 @@ describe('QueryCursor', function() {

it('post hooks (gh-9435)', function() {
const schema = new mongoose.Schema({ name: String });
schema.post('find', function(doc) {
doc.name = doc.name.toUpperCase();
schema.post('find', function(docs) {
docs.forEach(doc => { doc.name = doc.name.toUpperCase(); });
});
const Movie = db.model('Movie', schema);

Expand Down

0 comments on commit 43b0cfa

Please sign in to comment.