title: how to structure many-to-many relationships in mongoose?
body: <p>In my app, users have events and groups - and events can (but don't need to) belong to  groups. I'm still new to non-relational DBs, so I'd like to know best practices for optimally structuring this.</p>
  
  <pre><code>    var user = new mongoose.Schema({
          name: { type: String },
          events: [event],
          groups: [group]
      });
  
      var group = new mongoose.Schema({
          name: { type: String }
      });
  </code></pre>
  
  <p>This is where I'm confused.</p>
  
  <pre><code>    var event = new mongoose.Schema({
          name: { type: String }
          groups: ????
      });
  </code></pre>
  
  <p>Do I just keep an array with references to the id of group?</p>
  
  <p>If I do that, how would I find events by group? </p>
  
  <p>And if a group is deleted, would I have to iterate over each event to remove the reference?</p>