gpt4 book ai didi

mongodb - 是什么导致mongodb中的此索引错误?

转载 作者:行者123 更新时间:2023-12-02 10:54:03 25 4
gpt4 key购买 nike

我已经基于导入到mongodb中的Yelp的几个json文件创建了3个索引。

> db.review.createIndex({"text":"text"})
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"ok" : 1
}
> db.business.createIndex({"categories":"text"})
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"ok" : 1
}
> db.business.createIndex({"attributes":"text"})
{
"ok" : 0,
"errmsg" : "Index with pattern: { _fts: \"text\", _ftsx: 1 } already exists with different options",
"code" : 85

基本上,我试图创建3个索引以使mongodb中的count函数更快。
"errmsg" : "Index with pattern: { _fts: \"text\", _ftsx: 1 } already exists with different options"是什么意思?

我应该选择一个不同的东西作为属性,还是应该删除它?

最佳答案

MongoDB (as of v3.4) only allows one text index per collection

business集合中,您已经在categories上建立了文本索引。因此,在attributes上的第二个文本索引将失败。

关于mongodb - 是什么导致mongodb中的此索引错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43712109/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com