Skip to content

Commit

Permalink
chore: clean up test failures on 6.0 branch re: #9909
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Feb 16, 2021
1 parent 623fff8 commit 13236a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/schema/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,10 @@ SchemaArray.prototype.applyGetters = function(value, scope) {

const ret = SchemaType.prototype.applyGetters.call(this, value, scope);
if (Array.isArray(ret)) {
const len = ret.length;
const rawValue = ret.isMongooseArrayProxy ? ret.__array : ret;
const len = rawValue.length;
for (let i = 0; i < len; ++i) {
ret[i] = this.caster.applyGetters(ret[i], scope);
rawValue[i] = this.caster.applyGetters(rawValue[i], scope);
}
}
return ret;
Expand Down
2 changes: 1 addition & 1 deletion lib/types/array/methods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const methods = {
if (arguments.length) {
dirtyPath = dirtyPath + '.' + elem;
}

if (dirtyPath != null && dirtyPath.endsWith('.$')) {
return this;
}
Expand Down
7 changes: 4 additions & 3 deletions lib/types/subdocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ Subdocument.prototype.$parent = Subdocument.prototype.parent;
*/

Subdocument.prototype.$__remove = function(cb) {
if (cb == null) {
return;
}
return cb(null, this);
};

Expand All @@ -306,9 +309,7 @@ Subdocument.prototype.remove = function(options, callback) {
this.$__removeFromParent();
}

if (typeof callback === 'function') {
callback(null);
}
return this.$__remove(callback);
};

/*!
Expand Down

0 comments on commit 13236a9

Please sign in to comment.