【发布时间】:2022-01-04 20:27:10
【问题描述】:
我在 MongoDB 集合中有文档,这些文档引用了不同集合中的 ObjectId。例如,我的 Orders 集合包含带有 CustomerId 的文档。
使用 MongoDB Atlas 搜索,我定义了一个索引,允许我使用以下语法搜索 CustomerId 字段:
{
"index": "Orders",
"equals": {
"path": "CustomerId"
"value": new ObjectId("5m5....")
}
}
(上面的 sn-p 来自我的聚合管道的 $search 阶段。)
但现在我需要使用多个客户 ID 执行 OR 搜索。不幸的是,在使用 equals 运算符时,我不能只指定一个 ObjectIds 数组。 https://docs.atlas.mongodb.com/atlas-search/equals/
在搜索具有多个 ObjectId 的 MongoDB Atlas Search 索引时,我有哪些选择?
【问题讨论】:
标签: mongodb mongodb-atlas mongodb-atlas-search