How it works...

By limiting population to our load and read method, we guarantee we will only invoke population when we make requests for a specific user. This is important, because population can be a source of performance loss if our database performs population too often. Much like an SQL query with too many JOIN operations, having too many populate operations can slow down your query time significantly. By limiting our populate query to only when we are fetching a single user record, we are providing some built-in limits to the scope of how many documents will be populated in any given request.

The populate method is a very powerful tool for composing different documents together in MongoDB, and provides the closest option to how a relational database would approach data modeling. Use it carefully, and it will be an invaluable tool in modeling your objects in a way that matches the needs of your application.

For more information, you can visit the following link:

http://mongoosejs.com/docs/populate.html

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.205.166