mongo-control
Advanced tools
Comparing version 1.0.13 to 1.0.14
@@ -108,3 +108,5 @@ var MongoClient = require('mongodb').MongoClient; | ||
db.collection(params.collection).insert(params.data, {keepGoing: params.keepGoing}, function(e, r) { | ||
db.collection(params.collection).insert(params.data, { | ||
keepGoing: params.keepGoing | ||
}, function(e, r) { | ||
if (e) return err(e); | ||
@@ -394,2 +396,12 @@ | ||
if (params.id) { | ||
if (reMongoId.test(params.id)) { | ||
try { | ||
params.query._id = new ObjectID(params.id); | ||
} catch (idErr) { | ||
console.warn(idErr); | ||
} | ||
} else params.query._id = params.id; | ||
} | ||
MongoClient.connect(params.db, function(e, db) { | ||
@@ -400,7 +412,7 @@ if (e) return err(e); | ||
if(params.fields) { | ||
if(typeof params.fields == "string") | ||
if (params.fields) { | ||
if (typeof params.fields == "string") | ||
params.fields = JSON.parse(params.fields); | ||
params.fields.forEach(function (a) { | ||
params.fields.forEach(function(a) { | ||
unsetObj[a] = ""; | ||
@@ -407,0 +419,0 @@ }); |
{ | ||
"name": "mongo-control", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Simple functions to control mongo", | ||
@@ -5,0 +5,0 @@ "main": "mongo.control.js", |
13592
410