mongo-control
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -306,14 +306,12 @@ var MongoClient = require('mongodb').MongoClient; | ||
return new Promise(function(res, err) { | ||
if (!params.db || !params.collection) return err("!params.db || !params.collection"); | ||
if (!params.db || !params.collection || !params.query) return err("!params.db || !params.collection || !params.query"); | ||
if (params.query) { | ||
if (typeof params.query == "string") { | ||
try { | ||
params.query = JSON.parse(params.query); | ||
} catch (e) { | ||
params.query = {}; | ||
err(e); | ||
} | ||
if (typeof params.query == "string") { | ||
try { | ||
params.query = JSON.parse(params.query); | ||
} catch (e) { | ||
params.query = {}; | ||
err(e); | ||
} | ||
} else params.query = {}; | ||
} | ||
@@ -320,0 +318,0 @@ MongoClient.connect(params.db, function(e, db) { |
{ | ||
"name": "mongo-control", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Simple functions to controll mongo", | ||
@@ -5,0 +5,0 @@ "main": "mongo.control.js", |
12708
382