Best way to model Client to ClientAddress list with external ClientAddress references

13 views
Skip to first unread message

billba...@hotmail.com

unread,
Mar 2, 2012, 7:41:19 PM3/2/12
to ravendb
I have the following scenario.

I have a Client entity associated to a list of ClientAddresses.
From an aggregate modeling perspective, it would be preferable to have
the list of ClientAddresses contained within the Client document.
There are also various other entities that will require a reference to
a specific ClientAddress. For example, storing the ClientAddress as a
user selection for the address where a Client received a service.
Denormalization really isn't an option as the ClientAddresses will
change often.

Questions:

Can I/should I store the ClientAddress list inside of the Client and
somehow generate unique ids for the collection items and so also
across all ClientAddress lists that can be persisted in the various
other entities?

Or should the ClientAddresses stored as a separate document that
references its Client document? The document keys can be persisted to
the external entities. In general this approach is more difficult to
access the ClientAddress list for query etc.

Concerning the external references to ClientAddress in various other
entities. If the ClientAddress lists can be effectively stored in each
Client can the be efficiently queried for across multiple Clients?

Is there a better approach than the 2 outlined? Meaning, Internal
ClientAddress list or External ClientAddress list?

billba...@hotmail.com

unread,
Mar 3, 2012, 11:55:44 AM3/3/12
to ravendb
Adding with respect to the requirement to look up a specific address
were each Client contains its own list of ClientAddresses, that there
will be approx. 5000 Clients each with 2 to 3 ClientAddresses.

On Mar 2, 7:41 pm, "billbassl...@hotmail.com"

Dody Gunawinata

unread,
Mar 4, 2012, 4:11:15 AM3/4/12
to rav...@googlegroups.com
Since it seems that ClientAddress get used by other documents quite
frequently, I think it's better to put them in separate document.

If you put ClientAddress in separate document, you can simply use the
"include" feature when you want to retrieve it via Client or other
documents.

--
nomadlife.org

Oren Eini (Ayende Rahien)

unread,
Mar 4, 2012, 7:09:07 AM3/4/12
to rav...@googlegroups.com
Is there a _meaning_ to ClientAddress outside of a client?
If you need to refer to a client address from another document, what do you actually store there?
Is it the address reference, address value?
Reply all
Reply to author
Forward
0 new messages