在$ or或mongodb中使用$ text搜索

问题描述 投票:0回答:1

我正在尝试在$ or内使用$ text搜索。

await Creators.aggregate([
 {$match: {
  $or: [
    { $creatorId: { $in: [407, 409] } }, 
    { $text: { $search: "Michael"} } ] 
  } }
])

查询将不起作用。但是没有$ or的$ text可以正常工作。

有人对此有想法吗?谢谢。

mongodb aggregation-framework text-search
1个回答
0
投票

$text运算符表达式在聚合中不能在$ or或$ not表达式中使用。请参阅to doc

© www.soinside.com 2019 - 2024. All rights reserved.