所以我有一个奇怪的配置数据库导入 MongoDB,看起来像这样:
"_id" : ObjectId("51191d45890311d9b2a0865d"),
"field1" : "randomtextstuff",
"field2" : "randomtextstuff",
"field3" : "randomtextstuff",
"field4" : "randomtextstuff",
"field5" : "randomtextstuff"
有些文档有 100 个字段,有些则没有。
所以我想测试新的文本搜索,所以我尝试了以下索引:
db.profile_specialties.ensureIndex({"field1":"text",
"field2":"text",
"field3":"text",
"field4":"text",
"field5":"text",
"field6":"text",
... All the way to 100
"field96":"text",
"field97":"text",
"field98":"text",
"field99":"text",
"field100":"text"})
返回的错误信息是:
{
"err" : "ns name too long, max size is 128",
"code" : 10080,
"n" : 0,
"connectionId" : 1,
"ok" : 1
}
有没有其他人遇到过这个问题?