title: Doing Firebase Update that Adds a Child
body: <p>I'm trying to add a child node during an update. Best by example:</p>
  
  <pre><code>name: 'mike'
        address: '123 main street'
  
  name: 'paul'
        address: '1189 second avenue'
  
  name: 'ethyl'
        address: '22 appletree lane'
        pet_count: 3
  </code></pre>
  
  <p>So, "mike" goes off and gets a dog at the shelter, so I have to add his pet if he doesn't have any or increment the count if he does have one. The desired results are:</p>
  
  <pre><code>name: 'mike'
        address: '123 main street'
        pet_count: 1
  
  name: 'paul'
        address: '1189 second avenue'
  
  name: 'ethyl'
        address: '22 appletree lane'
        pet_count: 3
  </code></pre>
  
  <p>Now, if I add another pet to mike's fast-growing herd, I get...</p>
  
  <pre><code>name: 'mike'
        address: '123 main street'
        pet_count: 1
  
  name: 'paul'
        address: '1189 second avenue'
  
  name: 'ethyl'
        address: '22 appletree lane'
        pet_count: 3
  </code></pre>
  
  <p>I understand the incrementing of the count is application-specific and I'm ok with that. I'm just not seeing how to add that <code>pet_count</code> node if none is present. Any language is fine. Javascript seems neutral if you want to answer in code.</p>
  
  <p>I've tried things like:</p>
  
  <pre><code>nameRef.child('mike').set({address: '123 main street',
                             pet_count: 1});
  </code></pre>
  
  <p>and it fires the changed event but I can't see that on the Forge. I don't think the data is persisted.</p>
  
  <p>I've also tried:</p>
  
  <pre><code>nameRef.update({name: 'mike', {address: '123 main street',
                             pet_count: 1});
  </code></pre>
  
  <p>Those last two should have been equivalent, right?</p>
  
  <p>Any hints what I'm missing here?</p>