September 2017
Intermediate to advanced
450 pages
11h 24m
English
Mongoose is a node module similar to the many other node modules we have used within Express in this book. Its main role is to handle the connection to the MongoDB database. This connection is asynchronously resolved through the URI mongodb://localhost/mean-db. This same request can be modified to connect to different servers or databases. In our case, we are simply connecting to our localhost MongoDB process, and loading the mean-db database:
mongodb://<server>/<data-base>
The connection object we get back from Mongo can bound to event listeners for startup and failure callbacks from Mongoose. Attempting to make requests before MongoDB is connected will simply queue them in Mongoose until a connection is established. Exiting ...
Read now
Unlock full access