mongodb text search with multiple fields

前端 未结 2 745
抹茶落季
抹茶落季 2020-12-05 19:37

I\'m trying to get mongodb fulltext search with multiple fields working. I\'ve set the index on 3 fields-name,description, category, and verified with

documen

2条回答
  •  离开以前
    2020-12-05 20:09

    using the example above

    db.deals.ensureIndex({ name: "text", description : "text", category : "text" });
    

    Does this mean that I am creating one index or 3, and also can I search just the name or description only, or do I have to always list all 3?

    Also, what if I wanted to add another index for phone number?

提交回复
热议问题