Skip to content

Commit

Permalink
Fix pushing a value to an array without schema
Browse files Browse the repository at this point in the history
  • Loading branch information
lukejagodzinski committed Oct 18, 2015
1 parent 398b263 commit 7e43b94
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/modules/fields/pop.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ proto._popOne = function(fieldName, popValue, options) {
Class.emitEvent(event);
};

proto._popMany = function(fieldsValues, options) {
proto._popMany = function(popValues, options) {
var doc = this;

// Set multiple fields.
_.each(fieldsValues, function(popValue, fieldName) {
_.each(popValues, function(popValue, fieldName) {
doc._popOne(fieldName, popValue, options);
});
};
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/fields/pull.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ proto._pullOne = function(fieldName, pullValue, options) {
// Add modifier.
if (options.modifier) {
if (_.isUndefined(modifierPulledValue)) {
modifierPulledValue = EJSON.clone(fieldValue);
modifierPulledValue = EJSON.clone(pullValue);
}
if (nestedDoc instanceof Astro.BaseClass) {
if (_.isUndefined(index)) {
Expand Down Expand Up @@ -154,11 +154,11 @@ proto._pullOne = function(fieldName, pullValue, options) {
Class.emitEvent(event);
};

proto._pullMany = function(fieldsValues, options) {
proto._pullMany = function(pullValues, options) {
var doc = this;

// Pull multiple values.
_.each(fieldsValues, function(pullValue, fieldName) {
_.each(pullValues, function(pullValue, fieldName) {
doc._pullOne(fieldName, pullValue, options);
});
};
Expand Down
8 changes: 4 additions & 4 deletions lib/modules/fields/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ proto._pushOne = function(fieldName, pushValue, options) {
// Add modifier.
if (options.modifier) {
if (_.isUndefined(modifierPushedValue)) {
modifierPushedValue = EJSON.clone(fieldValue);
modifierPushedValue = EJSON.clone(pushValue);
}
if (nestedDoc instanceof Astro.BaseClass) {
if (_.isUndefined(index)) {
Expand Down Expand Up @@ -153,12 +153,12 @@ proto._pushOne = function(fieldName, pushValue, options) {
Class.emitEvent(event);
};

proto._pushMany = function(fieldsValues, options) {
proto._pushMany = function(pushValues, options) {
var doc = this;

// Set multiple fields.
_.each(fieldsValues, function(fieldValue, fieldName) {
doc._pushOne(fieldName, fieldValue, options);
_.each(pushValues, function(pushValue, fieldName) {
doc._pushOne(fieldName, pushValue, options);
});
};

Expand Down

0 comments on commit 7e43b94

Please sign in to comment.