exp my collection users
[
{
_id: ObjectId('123456')
username: 'test'
},
{
_id: ObjectId('654321')
username: 'test2'
},
{
_id: ObjectId('789101')
username: 'test3'
}
]
my array available :
var usersId = [ObjectId('123456'), ObjectId('654321')]
i want find with field username and just in array usersId available
my test not working :
db.users.find({
username: keyword,
_id: { $in: usersId }
})