I would like to retrieve documents from the DB that match a manager Id and employee ids which comes in an array.
SELECT * FROM XXX WHERE MANAGER_ID=<manager_id> AND EMPLOYEE_ID IN [....]
Here my code:
var query = [
{
"$and": [
{"employee": { $in : employees}},
{"manager": ObjectId(managerId)}
]
}
];
But in actuality, the query returns all documents in the model. Please advise.
[]... It should bevar query = { "$and": [ {"employee": { $in : employees}}, {"manager": ObjectId(managerId)} ] }