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 dbslocal 0.009GBmeteor 0.005GB

To switch to the meteor database, use:

meteor:PRIMARY> use meteorswitched to db meteor

To show all the collections in the database, use:

meteor:PRIMARY> show collectionsrestaurants

To count the number of documents ...

Get Build Applications with Meteor now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.