【发布时间】:2023-04-02 14:17:01
【问题描述】:
我在 mongodb 中有一个 collection 的订单,其中包含一个名为 line_items 的子文档数组。
我想搜索/过滤line_item.code 与提供的代码匹配的所有订单。
我只想访问 Array not complete 数组中匹配的line_item。
我是 mongodb 的新手,尝试了 $elemMatch 和 $filter,但没有成功
【问题讨论】:
-
请提供示例文档和预期输出。
标签: mongodb mongoose aggregation-framework