Is there any way to search (FULLTEXT) in a specific field in MongoDB?

2

I have a full-text index in MongoDB and need to search only on top of a field, rather than all. Anyone know if this is possible?

    
asked by anonymous 18.04.2014 / 03:53

2 answers

1

According to MongoDB documentation , it supports the indexing and search of text from the version 2.4, if enabled. As of version 2.6, this feature is available by default.

To create a text index, do:

db.reviews.ensureIndex( { comments: "text" } )

The text indexing engine supports several languages, listed here .

To perform the search, use the $text operator, whose syntax is:

{ $text: { $search: <string>, $language: <string> } }
    
24.04.2014 / 21:22
0

I do not have good knowledge on MongoDB, but this link will help you in detail.

Full text search in MongoDB

    
19.04.2014 / 05:51