I need to get from the database objects from each element in the array files, by array of ids ["c5f2d584-60ab-4068-b567-9b422f6c4e24","09c0ef39-55ea-45b4-88d3-a8f97730d6d3"]
.
How to make such a request?
model.find({
files: '_id' : ["c5f2d584-60ab-4068-b567-9b422f6c4e24","09c0ef39-55ea-45b4-88d3-a8f97730d6d3"]
}).
then(res => {
console.log(res)
});
You can use the $in operator like this:
model.find({
"files._id": { $in: ["c5f2d584-60ab-4068-b567-9b422f6c4e24","09c0ef39-55ea-45b4-88d3-a8f97730d6d3"] }
}).
then(res => {
console.log(res)
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.