Perform a diff between two objects expressed as MongoDB operations
Component to perform a diff between two objects expressed as MongoDB operations.
var diff = require'mongo-diff';// diff two arrays using set strategydiff'a' 'b' 'c' 'b' 'c' 'a'/*[['pull', 'a'],['push', 'a']]*/
diff'a' null// [['unset', 1]]diff1 5// [['inc', 4]]
diffval'a' 'b'// [['set', 'b']]diffval'a' null// [['unset', 1]]
Expresses differences as
diffinc5 8 interval: 1// [['inc', 1], ['inc', 1], ['inc', 1]]
intervalincrement interval. If
nullthe interval defaults to the difference between the numbers (
Expresses differences between numbers in terms of
diffordered_set 'a';// [['push', 'a']]
Expresses the difference between arrays as a series of
operations. Useful to match differences on arrays that are used with
$addToSet MongoDB operation.