title: How do I prevent duplicate voting while incrementing the vote count on Firebase?
body: <p>I'm building a real-time poll in Firebase. Each vote is stored in a list field. To prevent having to pull every vote down to the client in order to count them, I cache the tallies for each choice in counter fields.</p>
  
  <pre><code>poll1
      counts
          choice1: 5
          choice2: 2
          choice3: 10
          choice4: 252
      voters
          uid1 : choice1
          uid6 : choice3
          uid25: choice2
          uid31: choice1
  </code></pre>
  
  <p>I'm currently updating the counter with the following transaction:</p>
  
  <pre><code>var fireCountPush = new Firebase(self.fireCountUrl+node+id);
  fireCountPush.transaction(function(current_value) {
      return current_value + 1;
  }, function(error, committed, snapshot) {
      if(committed) {
          var fireVote = new Firebase(self.fireVotesUrl);
          fireVote.child(self.user.uid).set(id);
      }
  });
  </code></pre>
  
  <p>However, I want to atomically add the user to the voters list, ideally in the same transaction. Unfortunately, the way I have it now, I'm having to add the user after the transaction commits successfully. This is a huge security issue since it can be easily disabled in the browser by editing the script.</p>
  
  <p>Is there any way to both update the counter <em>and</em> add a user to the list of voters without having to download the entire object in the transaction?</p>