2
I have a full-text index in Mongodb and I need to search only on top of one field instead of all. Does anyone know if this is possible?
2
I have a full-text index in Mongodb and I need to search only on top of one field instead of all. Does anyone know if this is possible?
1
In accordance with the mongodb documentation, it supports indexing and text searching from 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" } )
Text indexing engine supports multiple languages, listed here.
To perform the search, use the operator $text
, whose syntax is:
{ $text: { $search: <string>, $language: <string> } }
0
I don’t have good knowledge in Mongodb, but this link will help you in detail.
Browser other questions tagged mongodb
You are not signed in. Login or sign up in order to post.