title: Using transaction to swap two values- I dont think i can do this securely
body: <p>I am trying two swap two valuues with firebase, and no matter what I do I cant seem to find anything thats secure.</p>
  
  <p>UserA is in 23, userB is in position 5, I want to swap these two numbers..</p>
  
  <p>obviously I should be using a transaction for this because one value is dependant on the other. At the moment I have my data set up like this-</p>
  
  <pre><code>-world
      -pos23
          -userA
      -pos5
          -userB
      -pos98
          -otherUser
      etc...
  </code></pre>
  
  <p>Obviously I could structure this differently- invert the users and position but it doesnt seem to help my problem which is-</p>
  
  <p>If I want to do a transaction on these two users I have to apply it to "world", I cant apply it to a position because I need access to the other position. To do a transaction I have to provide read and write access to the whole world, which means any sort of security rules I apply to the way the data is modified at the lower level is useless- the world level read and write overrides it. What if i want to make it so userC cant be moved at all.</p>
  
  <p>From my experiments this security rule invalidates any transaction i do, -</p>
  
  <pre><code>{
    "rules": {
      ".read": true,
      "$anyPosition": {
        ".write": true,
      },
    }
  }
  </code></pre>
  
  <p>I would think that grants access to anything in the structure, but it actually fails because I dont have a write:true at world level. It lets me use set but not transaction.</p>
  
  <p>I might be going about this the wrong way, <strong>how should I be swapping two values securely?</strong></p>