sql - How to map a model with an optional parent in NOSQL -


i'm in situation have 2 entities in database i'm trying convert nosql. site , customer

  1. a customer has sites
  2. a site can belong customer doesn't need one

i started thinking swap around have collection of sites can each have customer doesn't require one. still feel customer should parent seems more natural. sites without customer in case.

is there convention out there dealing situation? admit i'm still getting used how things work in nosql

thanks in advance.

if use object oriented database suggestion implement classes site, customer , sitepercustomer this

[database] public class site {     ... }  [database] public class customer {      public ienumerable<site> connectedsites      {                   {               return sql<site>("select s.site sitepercustomer s s.connectedcustomer=?", this);           } }  [database] public class sitepercustomer {     public site connectedsite;     public customer connectedcustomer; } 

then can use customer , site well. customer instances can relate sites using property or method.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -