June 2017
Beginner to intermediate
404 pages
8h 22m
English
As defined in the sample data, we have the products as parent documents and the product reviews as children documents. A sample document is shown next:
PUT chapter8/product/1?refresh=true { "product_name": "iPhone 6", "manufacturer": "Apple", "variations": [ { "color": "Gray", "storage": "16GB", "unit_price": "600" } ] } #Child Documents POST chapter8/product_review/?parent=1 { "user_id": "user1", "comment": "One of the best phones in the market" }
Suppose we want to find the number of product reviews for each manufacturer. The product review is in the child document, and the manufacturer is in the parent document. Due to parent-child mapping, to use the children aggregation, the child document type (
Read now
Unlock full access