This is collection sessions
{
"_id": "R65i3SmvucW9imK2cxA6wdFb.GXoSHjly7obzFNslklNCBvE0UrW/qOiNmiBtPN24/1c",
"session": {
"channel": "all",
"username": "xuka"
},
"expires": NumberLong("1307692520000")
} {
"_id": "zJYZj2jwxa5zN0uZcCZC26zp.Tpp8fVkqwKLZEpRWgq7/3DDTcDw9VSlskBum28gox+0",
"session": {
"channel": "3",
"username": "hellos"
},
"expires": NumberLong("1307692826000")
}
I need to find records where channel is not equal 3, below is what I've tried
var k =3;
db.collection('sessions', function(err, collection){
collection.find({channel:{'$ne':k}},function(err, cursor) {
});
});
problem: the result gives me all the record where channel = 3. It's wrong.