title: MongoDB relations strategy, using mongoose node js
body: <p>right now I am using MongoDB for the first time, and I have the need to implement relations. As far as I understand the standard way to go is to use this: </p>
  
  <pre><code>stories : [{ type: Schema.Types.ObjectId, ref: 'Story' }]
  </code></pre>
  
  <p>But if I want to have a many to many relation I have to perform the push action on 2 objects right? So my idea was to define a Relation model which joins 2 objects by holding a ref to each object. But how can I define the 'ref' parts of the above code dynamically. Is there a more elegant way ? Thanks for your help.</p>