title: Firebase gives sometimes only parts of my saved values and sometimes everything
body: <p>I'm trying to code my own messenger. I saved the messages in Firebase database. I'm trying to access the messages with the normal way how I do it every time (database.database().reference().child("users")...., but it gives back only a few messages and only sometimes every message</p>
  
  <p>I already tried it with .childAdded but it doesn't work either</p>
  
  <pre><code>func fetchMessages() {
          self.messages.removeAll()
          let uid = Auth.auth().currentUser!.uid
          let ref = Database.database().reference().child("users").child(uid).child("chats").child(self.chatuid).child("messages")
          ref.observeSingleEvent(of: .value) { (snap) in
              guard let data = snap.value as? [String: AnyObject] else { return }
              //MARK: data = (messageID, AnyObject)
              for (messageID, _) in data {
                  ref.child(messageID).observeSingleEvent(of: .value) { (snap2) in
                      guard let data2 = snap2.value as? [String: AnyObject] else { return }
                      //MARK: data2 = ("message": String, "sentuid": String)
                      guard let message = data2["message"] as? String else { return }
                      guard let sentuid = data2["sentuid"] as? String else { return }
                      let messageToAppend = Message(sentuid: sentuid, message: message)
                      self.messages.append(messageToAppend)
                      self.messageTableView.reloadData()
                  }
              }
          }
      }
  
  //self.messages = Place where I save my fetched messages
  </code></pre>
  
  <p>Firebase-Structure:</p>
  
  <pre><code>{
  
  
  "users" : {
      "V3bLZu61KYTCG0uCWV8LH1f4rRJ3" : {
        "chats" : {
          "x3GzxwmyLbXrQNNyBF2a82KqrHa2" : {
            "messages" : {
              "20191014165454" : {
                "message" : "Heyho",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165647" : {
                "message" : "Blabla",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165754" : {
                "message" : "Blabla",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165800" : {
                "message" : "Fuchsloch",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165805" : {
                "message" : "Jlksaö",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165808" : {
                "message" : "Jadfsk",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165811" : {
                "message" : "Jskldflsö",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014170041" : {
                "message" : "JALSF",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "test" : {
                "messange" : "test",
                "sentUid" : "MatesForSports"
              }
            }
          }
        },
        "username" : "Acc2"
      },
      "x3GzxwmyLbXrQNNyBF2a82KqrHa2" : {
        "chats" : {
          "V3bLZu61KYTCG0uCWV8LH1f4rRJ3" : {
            "messages" : {
              "20191014165454" : {
                "message" : "Heyho",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165647" : {
                "message" : "Blabla",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165754" : {
                "message" : "Blabla",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165800" : {
                "message" : "Fuchsloch",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165805" : {
                "message" : "Jlksaö",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165808" : {
                "message" : "Jadfsk",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014165811" : {
                "message" : "Jskldflsö",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "20191014170041" : {
                "message" : "JALSF",
                "sentuid" : "V3bLZu61KYTCG0uCWV8LH1f4rRJ3"
              },
              "test" : {
                "messange" : "test",
                "sentUid" : "MatesForSports"
              }
            }
          }
        },
        "username" : "Acc1"
      }
    }
  }
  </code></pre>
  
  <p>I expected that the code would give back around 10 messages, but it gives sometimes 5, sometimes 3 or even only 2 messages</p>
  
  <p>My firebase-structure of the messages is .child("messages"), then a unique id, then the actual message and the sender at one layer</p>