How to do multiple text search using “$text query and $or” in mongodb / mongoose?

前端 未结 2 1308
清酒与你
清酒与你 2021-01-15 21:21

Here is the model \'Class\' model for which I have created the \"text\" index for \'keywords\',\'lifeArea\',\'\'type\'.

Structure of the model:

{
            


        
2条回答
  •  -上瘾入骨i
    2021-01-15 21:43

    First of all I don't think you can use $text in that manner, you need first to create a text index on the collection then you can use it but without specifying any field because it works on indexes not fields.

    Please check here: http://docs.mongodb.org/manual/administration/indexes-text/

提交回复
热议问题