lundi 9 février 2015

The MondoDB.org "Category Hierarchy" Example


I am creating an MVP app for a client but I am skilled in iOS mainly with only some DB experience. I'm using MongoDB.


The schema is for a Product Catalog for small markets. The client wants a hierarchy of 4 super categories. I found this example at http://ift.tt/1egQcM2:


enter image description here


I understand why the pointers lead to their ancestors in this example, as the main action here would be searching for individual products, and then returning associated category data with it.


However, what about in a top-down search?



  1. First, I would have to query for all Level 0 Categories (such as Ragtime)

  2. Second, I would have to query for all Level 1 Categories that point to Ragtime (such as Bop)

  3. Third, finally query for Product level items.


It seems like if the pointers were the other way around, I could perform this top-down search much faster. But I suppose then it would make it very difficult to include the category hierarchy in a Product level search.


This is the main tradeoff, correct?





Aucun commentaire:

Enregistrer un commentaire