title: Best way to model friend relationships for querying a user's friends with firestore
body: <p>I want to query all users that a user (user1) is friends with, in one query with firestore. </p>
  
  <p>Currently, I have a "friends" field in each user object, so to get the users who are friends w user1, I call:</p>
  
  <p>friendsOfUser1 = db.collection('users').where('friends', 'array-contains', user1).stream().</p>
  
  <p>This works well when users only have &lt; 100 friends, but after that the user objects get very large since the user.friends array has many values. This makes receiving user objects expensive.</p>
  
  <p>Is there a way to store the friends array outside of the user documents while still being able to query a user's friends in one query? This is what the structure is now:</p>
  
  <p>user1:
      {friends: ["user2", "user3", "user7", "user9"],
      name: "John Sci"}</p>
  
  <p>user2:
      {friends: ["user1", "user4", "user8", "user12"],
      name: "Elmo Square"}</p>
  
  <p>user3:
      {friends: ["user1", "user7", "user9"]}</p>
  
  <p>so db.collection('users').where('friends', 'array-contains', user1).stream() will give [user2, user3].</p>