I am using sailsjs mongodb and node.js
i am getting error following error in mongodb query please help!
i want to get result of those messages which match Exactly with $all: [ senderID , sendToID ]
this is my document "message" in mongodb.
{
"users": [
"52ed09e1d015533c124015d5",
"52ed4bc75ece1fb013fed7f5"
],
"user_msgs": [],
"createdAt": ISODate("2014-02-04T11:59:53.220Z"),
"updatedAt": ISODate("2014-02-04T11:59:53.220Z"),
"_id": ObjectID("52f0d639b922c9142763c336")
}
now i want to query
Message.find({ users : { $all: [ msg.sender , msg.sendTo ] } })
.done(function (err, detail) {
if (err) {
console.log(err)
} else {
console.log( detail)}
});
which returns error
{[MongoError:$all requires array] name:'MongoError'}
i am following documentation http://docs.mongodb.org/manual/reference/operator/query/all/ but still have no idea what is causing problem
msg.senderandmsg.sendTovalid?