-
-
Save romuloctba/2e311a36be0676493224 to your computer and use it in GitHub Desktop.
mongo index text search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For a specified field | |
db.collectionname.createIndex( | |
{ "field_name": "text" }, | |
{ name: "TextIndex" } | |
) | |
//For All Fields | |
db.collectionname.createIndex( | |
{ "$**": "text" }, | |
{ name: "TextIndex" } | |
) | |
db.collectioname.find({$text: { $search: mathQ }}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment