Here is what we do at GumGum for multi valued field:

1) Make a new family if there are large number of fields
2) Use JSON  or comma separated  string lists.
3) Make a composite column name such as email|work, email|home

It is not recommended to make a new family for small number of fields as
they are physically stored in a separates file.
In this case I think you might be better off going for option 3. But I
agree  with Suraj, it depends on the access pattern.

Regards,
Vaibhav

On Wed, Mar 9, 2011 at 8:44 PM, Suraj Varma <[email protected]> wrote:

> It really depends on your access patterns.
> One option could be having column names as email_<type> and the value as
> email address. (e.g email_home:[email protected], email_work:[email protected],
> etc). This will allow you to select specific emails (e.g. email_home and
> email_work) in your Get.
>
> Or if you prefer having both type and email address as values, you'd have
> to
> resort to a straight marshalling of the List<> as column names
> email_type_1:value=<type>, email_address_1:value=<address>. This would be
> appropriate if you always want the full set and you plan to reconstitute
> your List<> in full each time.
>
> --Suraj
>
>
>
> On Wed, Mar 9, 2011 at 5:46 PM, Cameron Leach
> <[email protected]>wrote:
>
> > ~resending to [email protected]~
> >
> > Is there a best-practice for modeling multi-valued fields (fields that
> are
> > repeated or collections of fields)? Our current data model allows for a
> > User
> > to store multiple email addresses:
> >
> > User {
> >  Integer id; //row key
> >  List<Email> emails;
> >
> >  Email {
> >    String type; //home, work, gmail, hotmail, etc...
> >    String address;
> >  }
> > }
> >
> > So if I setup a 'User' table with an 'Email' column family, how would one
> > support multiple email addresses, storing values for the 'type' and
> > 'address' columns? I've seen it suggested to have dynamic column names,
> but
> > this doesn't seem practical, unless someone can make it more clear how
> that
> > strategy would work.
> >
> > Thanks!
> >
>

Reply via email to