“Feature not supported: $text” in document db with mongodb 3.6 compatiability

*爱你&永不变心* 提交于 2020-12-12 09:36:58

问题


Hi I am using AWS documentDB with mongodb 3.6 compatiability but getting mentioned error in the function below. I am not sure how to get around this.

Index creation

ScenarioSchema.index({
"friendlyId": "text",
"steps.text": "text",
"title": "text"
}, { name: "scenarioTextIndex" });


var createSearchFilter = function (searchOptions)
 {
    var searchTerm = searchOptions.searchText || '';
    if (searchOptions.searchCondition.toUpperCase() === 'AND') {
        searchTerm = searchTerm.split(" ").join('" "');
    }
    if (searchOptions.excludeSearchText) {
        var excludeSearchText = searchOptions.excludeSearchText.split(" ").join(' -');
        searchTerm = searchTerm.concat(" -" + excludeSearchText);
    }
    var allowedPhases = getRoleBasedPhases(searchOptions.userRoles, searchOptions.phases);
    return {$text: {$search: searchTerm}, 'phase.code': {$in: allowedPhases}};
};

I am getting code: 303 errmsg: "Feature not supported: $text" message: "Feature not supported: $text" name: "MongoError"enter code here ok: 0


回答1:


The "MongoDB 3.6 compatibility" means DocumentDB supports some of MongoDB 3.6 features. There are many MongoDB features that DocumentDB does not implement, $text appears to be one of them.

https://www.mongodb.com/atlas-vs-amazon-documentdb

To get around this, use MongoDB.



来源:https://stackoverflow.com/questions/65131425/feature-not-supported-text-in-document-db-with-mongodb-3-6-compatiability

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!