title: Firebase update vs set
body: <p>As the title says, I can't get the differences between <code>update</code> and <code>set</code>. Also the docs can't help me, as the update example works exactly the same if I use set instead.</p>
  
  <p>The <code>update</code> example from the docs:</p>
  
  <pre><code>function writeNewPost(uid, username, title, body) {
  
      var postData = {
          author: username,
          uid: uid,
          body: body,
          title: title,
          starCount: 0
      };
  
      var newPostKey = firebase.database().ref().child('posts').push().key;
  
      var updates = {};
      updates['/posts/' + newPostKey] = postData;
      updates['/user-posts/' + uid + '/' + newPostKey] = postData;
  
      return firebase.database().ref().update(updates);
  }
  </code></pre>
  
  <p>The same example using <code>set</code></p>
  
  <pre><code>function writeNewPost(uid, username, title, body) {
  
      var postData = {
          author: username,
          uid: uid,
          body: body,
          title: title,
          starCount: 0
      };
  
      var newPostKey = firebase.database().ref().child('posts').push().key;
  
      firebase.database().ref().child('/posts/' + newPostKey).set(postData);
      firebase.database().ref().child('/user-posts/' + uid + '/' + newPostKey).set(postData);
  }
  </code></pre>
  
  <p>So maybe the example from the docs should be updated, because now it looks like <code>update</code> and <code>set</code> do the exact same thing.</p>
  
  <p>Kind regards,
  Bene</p>