mongopatch
Advanced tools
Comparing version 0.8.2 to 0.8.3
{ | ||
"name": "mongopatch", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"repository": "git://github.com/e-conomic/mongopatch.git", | ||
@@ -5,0 +5,0 @@ "description": "MongoDB patching tool", |
@@ -168,2 +168,6 @@ mongopatch [![Build Status](https://travis-ci.org/e-conomic/mongopatch.png?branch=master)](https://travis-ci.org/e-conomic/mongopatch) | ||
#### Version 0.8.3 | ||
- Make is possible to pass `diffObject` option to the programmatic interface. This will produce a document diff which contains objects when doing changes on array-like instances (objects with numeric keys). | ||
#### Version 0.8.2 | ||
@@ -170,0 +174,0 @@ |
@@ -80,3 +80,3 @@ var flat = require('flat'); | ||
var deep = function(a, b) { | ||
var deep = function(a, b, options) { | ||
var change = diff(a, b); | ||
@@ -89,3 +89,3 @@ | ||
change = flat.unflatten(change); | ||
change = flat.unflatten(change, options); | ||
change = traverse(change).map(function(obj) { | ||
@@ -92,0 +92,0 @@ if(!Array.isArray(obj)) { |
@@ -150,3 +150,3 @@ var util = require('util'); | ||
var updateOptions = { afterCallback: that._after, concurrency: options.parallel }; | ||
var updateOptions = { afterCallback: that._after, concurrency: options.parallel, diffObject: options.diffObject }; | ||
var stream = streams.patch(collection, query, { concurrency: options.parallel }, worker); | ||
@@ -153,0 +153,0 @@ |
@@ -191,2 +191,3 @@ var fs = require('fs'); | ||
afterCallback: noopCallback, | ||
diffObject: false, | ||
concurrency: DEFAULT_CONCURRENCY | ||
@@ -230,3 +231,3 @@ }, options); | ||
patch.after = after; | ||
patch.diff = diff.deep(patch.before, patch.after); | ||
patch.diff = diff.deep(patch.before, patch.after, { object: options.diffObject }); | ||
patch.modified = !!Object.keys(patch.diff).length; | ||
@@ -280,2 +281,3 @@ | ||
afterCallback: noopCallback, | ||
diffObject: false, | ||
concurrency: DEFAULT_CONCURRENCY | ||
@@ -299,3 +301,3 @@ }, options); | ||
patch.after = after; | ||
patch.diff = diff.deep(patch.before, patch.after); | ||
patch.diff = diff.deep(patch.before, patch.after, { object: options.diffObject }); | ||
patch.modified = !!Object.keys(patch.diff).length; | ||
@@ -302,0 +304,0 @@ |
40024
985
207