未知运算符:$搜索管道mongodb stitch

未知运算符:$搜索管道mongodb stitch,mongodb,mongodb-query,pipeline,Mongodb,Mongodb Query,Pipeline,我正在尝试通过新的MongoDB特性使用文本操作符运行查询。我已经尝试了一些选项,但电话的回应是以下消息: 未知运算符:$search 如何解决此错误 我还创建了文本索引 { "v" : 2, "key" : { "_fts" : "text", "_ftsx" : 1 }, "name" : "script_text_description_text", "ns" : "test.scripts", "weight

我正在尝试通过新的MongoDB特性使用文本操作符运行查询。我已经尝试了一些选项,但电话的回应是以下消息:

未知运算符:$search

如何解决此错误

我还创建了文本索引

{
    "v" : 2,
    "key" : {
        "_fts" : "text",
        "_ftsx" : 1
    },
    "name" : "script_text_description_text",
    "ns" : "test.scripts",
    "weights" : {
        "description" : 1,
        "script" : 1
    },
    "default_language" : "english",
    "language_override" : "language",
    "textIndexVersion" : 3
}
尝试#1:

尝试#2:

尝试#3:

更新:

我把这项工作到处应用

import { StitchClientFactory,BSON } from 'mongodb-stitch';

let bsonRegex = new BSON.BSONRegExp(search, 'i')
        // showLoading();
        db.collection('clients').find({owner_id: client.authedId(),name:bsonRegex}).execute().then(docs => {
            funct(docs);
            // hideLoading();
        });

Stitch产品的Beta版目前不支持Stitch管道聚合操作中的全文搜索,但我们希望在Stitch达到GA(通用)时支持这些操作。

两年后,情况仍然相同,
$text
在Stitch中不受支持:

您是如何实现文本搜索的?现在MongoDB Atlas具有文本搜索功能,但它仅在M30群集和更大的群集上可用:


集合中文档的模式是什么?您希望实现什么?我用变通方法更新了原始问题。
db.collection('scripts').find({"$text":{"$search":'docker'}})
db.collection('scripts').aggregate([{
    "$match": {
        "$text": {
            "$search": "docker"
        }
    }
}])
import { StitchClientFactory,BSON } from 'mongodb-stitch';

let bsonRegex = new BSON.BSONRegExp(search, 'i')
        // showLoading();
        db.collection('clients').find({owner_id: client.authedId(),name:bsonRegex}).execute().then(docs => {
            funct(docs);
            // hideLoading();
        });