How you want to model many-to-many will depend on what queries you want to ask, how you want to update data, etc. .... Let's say that we have bindings to bars in many cases of the mod.
You can simulate foo as
{ 'bars': ['bar1', 'bar2', 'bar3'] }
and model the panel as
{ 'foos': ['foo_x', 'foo_y', 'foo_z'] }
Or you could model the graph or the relationship between foo and bar as separate documents themselves
{ from: 'foo1', to: 'bar1' } { from: 'foo1', to: 'bar2' } { from: 'foo2', to: 'bar3 } { from 'foo3', to: 'bar3' }
There are many other ways. How you want to do this will depend on the questions you want to ask, the operations you want to support, what you want to be effective, and the indexing available in the database.
Eric bloch
source share