title: MongoDB Aggregation and table modeling
body: <p>I am using MongoDB for a project that I am working on. My tables are designed as followed.</p>
  
  <pre><code>user = {
    id: ObjectID,
    friends: [ObjectID (user), ...]
    teams: [{
      "team_name": "example_team",
      "id": ObjectID,
      "users": [
        ObjectID (user),
        ObjectID (user),
        ....
      ]
    }]
  }
  </code></pre>
  
  <p>I am trying to execute a MongoDB query in which I can find a team and return all members of the team that are friends to a given user. Would this be a suitable use case for using MongoDB aggregation? I have looked into the features of it however could not figure out how to fit it into my model. Along with that, notice how I am storing teams inside of the user. Would it be a better practice to have another table to hold users teams? </p>
  
  <p>Thanks.</p>