MongoDB dokumentace

The Definitive Guide to MongoDB
The Definitive Guide to MongoDB, Third Edition
MongoDB The Definitive Guide
MongoDB The Definitive Guide, 2nd Edition
Scaling MongoDB
MongoDB in Action
MongoDB in Action, 2nd Edition
MongoDB and Python
50 Tips and Tricks for MongoDB Developers
MongoDB Applied Design Patterns
MongoDB Basics
Mongoose for Application Development
MongoDB Data Modeling
Practical MongoDB
MongoDB Cookbook, Second Edition

Best practice:
The best practice for a default Mongoose database connection is to open it when the application starts, and keep it open to be re-used. The connection should only need to be closed if your app is being shut down or restarted.

Mongoose provides a simple QueryBuilder interface for when you want to build up the query over multiple steps before executing it at a certain point in your code. Look at the example in the following snippet:

MongoDB and Mongoose do not support JOIN commands as MongoDB is not a relational database. Mongoose gives you an elegant way to achieve similar functionality by using population.

You can also populate multiple paths in the parent schema at once. Although, remember that each path is populated by a separate database query.

When populating data with a one-to-many relationship, you may well want to return a subset just like you might with a standard find operation. So far we’ve been using syntactic shortcuts for the populate method, but Mongoose does give you the option of sending a query object for population: