mongo-dot-notation
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -50,3 +50,4 @@ 'use strict' | ||
util.isArray(value) || | ||
util.isDate(value) | ||
util.isDate(value) || | ||
value.constructor.name === 'ObjectID' | ||
} | ||
@@ -53,0 +54,0 @@ |
{ | ||
"name": "mongo-dot-notation", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Convert simple objects to mongo update operators", | ||
@@ -19,3 +19,3 @@ "author": { | ||
"operators", | ||
"json", | ||
"json", | ||
"objects", | ||
@@ -33,4 +33,5 @@ "parsing", | ||
"chai": "^3.2.0", | ||
"mocha": "^2.2.5" | ||
"mocha": "^2.2.5", | ||
"mongodb": "^2.0.42" | ||
} | ||
} |
@@ -7,2 +7,4 @@ 'use strict' | ||
var ObjectID = require('mongodb').ObjectID | ||
describe('#primitive types scenarios', function () { | ||
@@ -34,2 +36,7 @@ it('when is an empty object returns empty', function () { | ||
it('when is ObjectID returns the object', function () { | ||
var id = new ObjectID() | ||
expect(dot.flatten(id)).to.equal(id) | ||
}) | ||
it('when is Array returns the Array', function () { | ||
@@ -257,3 +264,5 @@ var arr = [1, 2, 3] | ||
it('when has many inner properties with operators', function () { | ||
var obj = { | ||
var id = new ObjectID() | ||
var obj = { | ||
id: id, | ||
a: { | ||
@@ -278,2 +287,3 @@ b: { | ||
$set: { | ||
'id': id, | ||
'a.b.d': 2, | ||
@@ -280,0 +290,0 @@ 'n': { a: { b: { c: 'd' } } } |
22024
454
3