title: What Firebase Database structure is more appropriate? SWIFT 4, FIREBASE 5.0.0
body: <p>NOTE: Database = DB</p>
  
  <p>NOTE: I'm using SWIFT 4 and Firebase 5.0.0</p>
  
  <p>I am making a practice Instagram like project to practice using Firebase. I have tested the below 'DB 1' but then thought of 'DB 2' and was unsure about which one is more efficient and easier to code? The application is just supposed to upload a 'post' to a DB with 1 or 2 images. Thank you in advance!</p>
  
  <p>EDIT:
  Given that users would be able to see posts from people they follow and see posts from everyone on the search page. What would be an appropriate structure?</p>
  
  <p>DB 1:</p>
  
  <pre><code>{
    "user1" : {
      "posts" : {
        "post1" : {
          "imgURL" : "https://firebasestorage.googleapis.com/v0/b/datamodel2-52bdf.appspot.com/o/l@gmail.com%2Fpost1%2F19B28DCA-9CD1-4079-BC75-AB2981A64CE3?alt=media&amp;token=d984d2bd-698e-4cf4-8e42-36bf277850f2"
        },
        "post2" : {
          "imgURL" : "https://firebasestorage.googleapis.com/v0/b/datamodel2-52bdf.appspot.com/o/l@gmail.com%2Fpost1%2F19B28DCA-9CD1-4079-BC75-AB2981A64CE3?alt=media&amp;token=d984d2bd-698e-4cf4-8e42-36bf277850f2"
        }
      },
      "userInfo" : {
        "email" : "exmple@gmail.com",
      }
    },
    "user2" : {
      "posts" : "allposts",
      "userInfo" : "email"
    }
  }
  </code></pre>
  
  <p>DB 2:</p>
  
  <pre><code>    {
    "UserPosts" : {
      "User1ID" : {
        "Post1" : {
          "ImageURL1" : "URL"
        }
      }
    },
    "Users" : {
      "User1ID" : {
        "email" : "email"
      },
      "User2ID" : {
        "email" : "email"
      }
    }
  }
  </code></pre>