0
我传递一个JSON变量的模块,但我不能做我的收藏的更新,我总是有更新的错误。为什么更新不工作
var gestion = function(myJSON) {
var dburl = 'localhost/mongoapp';
var collection = ['clientes'];
var db = require('mongojs').connect(dburl, collection);
function cliente(nombre, estado, nuevo){
this.nombre = nombre;
this.estado = estado;
this.nuevo = nuevo;
}
var cliente1 = new cliente(myJSON.nombre myJSON.estado, myJSON.nuevo);
if (cliente1.estado == "desconectado"){
db.clientes.update(cliente1.nombre, {$set: {estado: "desconectado", nuevo: "no"}}, function(err) {
if (err) console.log("error "+cliente1.nombre);
else console.log("OK");
});
}
}
return 0;
}
我还试图删除我的数据库,并创建一个更多的时间,我敢肯定,我的目标在我的数据库存在。
和什么是您收到的错误消息? – AntonioOtero
错误:选择器必须是有效的JavaScript对象 – user2369478