Index a text field
In order to do a full-text search on a collection, we need to index a text field(s). Any field in our collection of the type string can be indexed; it can be just one field or all of them.
Let's start exploring the imported data by querying it in the shell.
Without stopping the application, open another terminal in the app directory and start the mongo shell:
>> meteor mongo
To see all the databases in our application, we can use the following command:
meteor:PRIMARY> show dbs local 0.009GB meteor 0.005GB
To switch to the meteor
database, use:
meteor:PRIMARY> use meteor switched to db meteor
To show all the collections in the database, use:
meteor:PRIMARY> show collections restaurants
To count the number of documents in the restaurant collection, use:
meteor:PRIMARY> db.restaurants.count() 25359
We have imported 25,359 documents in our collection. To get the first document of the collection, we can perform the following query:
meteor:PRIMARY> db.restaurants.findOne...