Skip to content

Commit

Permalink
Fix updating nested structures
Browse files Browse the repository at this point in the history
  • Loading branch information
neumino committed Jun 12, 2016
1 parent 2c09c1a commit f06e72f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ Document.prototype.replace = function(newValue, options, query, internalOptions)
Document.handleReplaceValue = function(self, replaceValue, primaryKey, options) {
var result = util.writeResult();
if (replaceValue === null) {
console.log('@@@@@@@@@@@@@@@@@@@@@@2');
self.delete({});
result.deleted++;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ util._merge = function _merge(self, obj) {
}
}
else {
changed = util._merge.call(self[key], obj[key]) || changed;
changed = util._merge.call(util, self[key], obj[key]) || changed;
}
}
else {
Expand Down
8 changes: 8 additions & 0 deletions test/writing-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,14 @@ describe('writing-data.js', function(){
var query = r.db(TEST_DB).table(TEST_TABLE).get(1);
compare(query, done);
});
it('update - 34 - more update', function(done) {
var query = r.db(TEST_DB).table(TEST_TABLE).get(1).update({foo: {bar2: {buzz2: 3}}});
compare(query, done);
});
it('update - 34 - more follow up', function(done) {
var query = r.db(TEST_DB).table(TEST_TABLE).get(1);
compare(query, done);
});

it('replace - 1', function(done) {
var query = r.db(TEST_DB).table(TEST_TABLE).get(1).replace({id: 1, foo: 200});
Expand Down

0 comments on commit f06e72f

Please sign in to comment.