[英]MongoDB find many objects from array, using array of matching id's
I have an array structures as such我有一个这样的数组结构
I've been trying to use an aggregation pipeline, and bulk.find() with a loop, and the $in operator, and none of these options seem to give me the power to (find many by an array of inputted id's).我一直在尝试使用聚合管道,以及带有循环的 bulk.find() 和 $in 运算符,但这些选项似乎都没有让我有能力(通过输入的 id 数组找到很多)。 How do you find many objects in an array filtering by an array of ID's that I already have?
您如何通过我已经拥有的 ID 数组过滤数组中的许多对象? I'm using PyMongo
我正在使用PyMongo
Using an aggregation pipeline, use an $in match after unwinding使用聚合管道,在展开后使用 $in 匹配
[
{$unwind: "groups.asana"},
{"source_id": {$in: ["id1", "id2", "id3"]}}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.