Skip to content

Commit

Permalink
fix(document): handle pull() on a document array when _id is an a…
Browse files Browse the repository at this point in the history
…lias

Fix #9319
  • Loading branch information
vkarpov15 committed Aug 27, 2020
1 parent c78c42d commit 568acaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/document.js
Expand Up @@ -3667,8 +3667,8 @@ Document.prototype.equals = function(doc) {
return false;
}

const tid = this.get('_id');
const docid = doc.get ? doc.get('_id') : doc;
const tid = this.$__getValue('_id');
const docid = doc.$__ != null ? doc.$__getValue('_id') : doc;
if (!tid && !docid) {
return deepEqual(this, doc);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/types/core_array.js
Expand Up @@ -605,7 +605,7 @@ class CoreMongooseArray extends Array {

if (values[0] instanceof EmbeddedDocument) {
this._registerAtomic('$pullDocs', values.map(function(v) {
return v._id || v;
return v.$__getValue('_id') || v;
}));
} else {
this._registerAtomic('$pullAll', values);
Expand Down

0 comments on commit 568acaf

Please sign in to comment.