title: Firebase security rule: compare two objects for equality?
body: <p>So I want to write a security rule to disallow writes if a child node is different then it previously was. E.g. imagine a situation where you want a node to only be writable on creation but never thereafter. Given this requirement, the most obvious solution would seem to be to verify that the new data is equal to the old data. </p>
  
  <p>Sadly, this does not work:</p>
  
  <pre><code>".write": "data.child('someNode').val() === newData.child('someNode').val()"
  </code></pre>
  
  <p>Nor a more sophisticated approach where I try to cast the object to a string:</p>
  
  <pre><code>".write": "!data.exists() || (data.child('someNode').val() + '') === (newData.child('someNode').val() + '')"
  </code></pre>
  
  <p>Any way this use case can be supported? </p>
  
  <p><em>Important Note:</em> The value at someNode <em>has</em> to be an object and can't simply be a string or other primitive. In the case of primitives, either of these methods work fine. </p>