The signature you should be using is
update(query, update, callback)
but you're passing a string for query
, which doesn't mean anything to Mongo. You may want to look at the docs for an overview, but for this specific instance, it looks like you're trying to find the document where nombre
is equal to the string at cliente1.nombre
. The query for this is a dictionary { nombre: cliente1.nombre }
, so that line should be
db.clientes.update({nombre: cliente1.nombre}, {$set: {estado: "desconectado", nuevo: "no"}}, function(err) {