Valid use case for parent-child?


(Nick Hoffman) #1

Hey guys. I'm wondering if a parent-child relation is suitable for the
problem that I'm trying to solve:

My application has 2 primary objects: Product, and Item. Each product has
1+ items. Each item is associated with 1+ products.

When searching for products, the attributes of each product's items need to
be considered. For example, if a product named "TF Gift Set" contains items
named "Megatron" and "Grimlock", searching for "Megatron" should return
this product.

In addition to searching through products' items, I'm trying to sort on
fields within products' items. However, I don't think this is possible if a
product contains more than 1 item. This is because sorting on items' "name"
field in the previous example would return more than 1 name ("Megatron" and
"Grimlock").

Is the parent-child feature suitable for what I'm trying to do? If it
isn't, what do you guys recommend? I'm all ears!

Thanks,
Nick


(system) #2