我试图运行
db.user.find({_id: { $in : ['561f9f6aae729de84253b8b7','561f9f72ae729de84253b8b9'] } } )
即使结果存在,它也不会返回任何结果。这个查询有什么问题吗?
{
"_id": ObjectId("561f9f58ae729de84253b8b5"),
"__v": NumberInt(0),
"email": "Jay@admin.com",
"gameStatus": "Left game",
"isJudge": false,
"isOnline": false,
"login_at": ISODate("2015-10-15T12:43:04.346+0000"),
"name": "Jay"
}, {
"_id": ObjectId("561f9f6aae729de84253b8b7"),
"__v": NumberInt(0),
"email": "sunil@admin.com",
"gameStatus": "Just joined",
"isJudge": false,
"isOnline": true,
"login_at": ISODate("2015-10-15T12:43:22.575+0000"),
"name": "Sunil"
}
答案 0 :(得分:1)
尝试使用 ObjectId()
db.user.find({_id: { $in : [ObjectId('561f9f6aae729de84253b8b7'),ObjectId('561f9f72ae729de84253b8b9')] } } )