title: Update multiple nodes and increment value by 1 in atomic style
body: <p>I have to update my code and implement another child update to a node by increasing its value by 1. My current code looks like this (which works fine):</p>
  
  <pre><code>String key = database.child("rides").push().getKey();
  
  Map&lt;String, Object&gt; childUpdates = new HashMap&lt;&gt;();
  childUpdates.put("/rides/" + key, ride.toMap());
  childUpdates.put("/ridesUser/" + ride.getUserID() + "/ownRides/" + key, ride.getTime());
  
  database.updateChildren(childUpdates, new DatabaseReference.CompletionListener() {
      @Override
      public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
      }
  });
  </code></pre>
  
  <p>An easy way to add the increment code would be:</p>
  
  <pre><code>childUpdates.put("/stations/" + ride.getFromID() + "/rideCount", fromStation.getRideCount() + 1);
  </code></pre>
  
  <p>But <code>fromStation.getRideCount()</code> could already be outdated, if another user added a ride with this station.
  I've read several posts about incrementing values by using a transaction. How can I combine child updates and transactions? Should I run a transaction on <code>"/stations/" + ride.getFromID()</code> and do my children updates within the <code>doTransaction()</code> method? Is this atomically?</p>