My Mongoose Command
Modelname.update(
{$and :[ {'field1' : field1}, {'field2' : field2}, {'field3' : field3}, {'field4' : field4}]},
{
$set : {'timestamp' : timestamp},
$inc : {speed_string: 1}
},{upsert: true}, function (err, record)
{
if (err)
{
}
else
{
}
});
As you can see that speed_string is a variable which is supposed to get increased in the real document or get upserted . I have logged it just before the query and it is indeed a string (and not empty like the error reads) but the query is not going through and I am getting this error.
"errmsg":"'$inc' is empty. You must specify a field like so: {$inc: {: ...}}"}
When I am replacing that variable with 'expected_string'
things are working fine and that is more confusing, nevertheless.
There is something I am doing wrong, help is appreciated.
via Gandalf the White
No comments:
Post a Comment