获取SyntaxError:意外的令牌。在集合中创建嵌入式索引时使用mongo shell

时间:2017-01-28 05:45:00

标签: mongodb

db.dashboard_project.createIndex({
  projectName:"text",
  projectDescription:"text",
  skillList.skillName:"text"
})

其中skillList有一个名为skillName

的字段

1 个答案:

答案 0 :(得分:1)

您需要将嵌入文档的字段放在双引号中:

db.dashboard_project.createIndex({
  projectName:"text",
  projectDescription:"text",
  "skillList.skillName":"text"
})