Book Image

Build Applications with Meteor

Book Image

Build Applications with Meteor

Overview of this book

This book starts with the basic installation and overview of the main components in Meteor. You’ll get hands-on multiple versatile applications covering a wide range of topics from adding a front-end views with the hottest rendering technology React to implementing a microservices oriented architecture.All the code is written with ES6/7 which is the latest significantly improved JavaScript language. We’ll also look at real-time data streaming, server to server data exchange, responsive styles on the front-end, full-text search functionality, and integration of many third-party libraries and APIs using npm. By the end of the book, you’ll have the skills to quickly prototype and even launch your next app idea in a matter of days.
Table of Contents (16 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
8
Build a Chatbot with Facebook’s Messenger Platform

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...