The Little Mongo DB Schema Design Book by Christian Kvalheim

The Little Mongo DB Schema Design Book by Christian Kvalheim

Author:Christian Kvalheim [Kvalheim, Christian]
Language: eng
Format: azw3, epub
Published: 2015-10-08T16:00:00+00:00


We want to retrieve the entire subtree of categories for the /electronics category.

Example 2: Fetch subtree of /electronics category 1 var col = db.getSisterDB("catalog").categories; 2 var categories = col.find({parent: /^\/electronics/});

Notice the regular expression /^\/electronics/ that we’re using. This regular expression matches all documents where the field parent starts with /^\/electronics/. The effect is such that the query will return all the categories in the subtree below /electronics.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.