带有对象数组的猫鼬查询

时间:2021-07-24 02:42:37

标签: mongodb mongoose

我想在对象数组中使用 _id 进行查询。

const members = [
  { _id: 60fb6f2859fd441f38e21172 },
  { _id: 60fb70a059fd441f38e21175 },
  { _id: 60fb6d9459fd441f38e2116c }
]

我知道如果它是一个简单的数组,我们可以使用 $in 运算符。请帮助如何使用上述数组进行查询。

const files = await File.find({ _id: { $in: members._id } });

0 个答案:

没有答案