2
votes

How would you handle dynamic fields indexing on nested documents so that you can query dynamic fields of a deep graph object with RavenDB?

Using the example from the documentation: http://ravendb.net/docs/2.0/client-api/advanced/dynamic-fields

What if the value of a product's attribute is also a product? Think of a CMS with dynamic fields where everything is a content and a root entity content (for the DDD guys) may embed another one, etc (deep graph).

This is very important since, aggregating child contents instead of relating to them (like you would do in a relational database world), is one of the core concept of document databases.

1

1 Answers

1
votes

If the data conforms to a pattern, such as with hierarchical data, then you can recurse into that data to index according to the recursion pattern.

You already found how to index dynamic fields. You can combine these techniques to get at most any pattern that you can describe.

If the data is arbitrarily dynamic (i.e. you have no way of knowing what the object structure is ahead of time), then you are going to have a hard time reaching any particular field because you can't describe how to access it.

You can't be arbitrarily dynamic and be completely indexable at the same time.