mongo-control
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -380,3 +380,3 @@ var MongoClient = require('mongodb').MongoClient; | ||
return new Promise(function(res, err) { | ||
if (!params.db || !params.collection || !params.field) return err("!params.db || !params.collection || !params.field"); | ||
if (!params.db || !params.collection || (!params.field && !params.fields)) return err("!params.db || !params.collection || !params.field(s)"); | ||
@@ -398,4 +398,9 @@ if (params.query) { | ||
var unsetObj = {}; | ||
unsetObj[params.field] = ""; | ||
if(params.fields) { | ||
params.fields.forEach(function (a) { | ||
unsetObj[a] = ""; | ||
}); | ||
} else unsetObj[params.field] = ""; | ||
db.collection(params.collection).updateMany(params.query, { | ||
@@ -402,0 +407,0 @@ "$unset": unsetObj |
{ | ||
"name": "mongo-control", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Simple functions to control mongo", | ||
@@ -5,0 +5,0 @@ "main": "mongo.control.js", |
13216
397