title: Casting String to Int in Cloud Firestore Security Rules
body: <p>I am <a href="https://stackoverflow.com/q/48795711/6509751">coming from this question</a>. I thought about starting a bounty on it because it has not received any attention in months and over the time I did not see any answers, but I think that my desire is a bit different.</p>
  
  <p>If there is a number as a field of a document, but specified as a <code>string</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/IdTcn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IdTcn.png" alt="screenshot"></a></p>
  
  <p>A problem with <a href="https://firebase.google.com/docs/firestore/security/get-started" rel="nofollow noreferrer">Firestore Rules</a> arises.</p>
  
  <p>Checks like this become impossible:</p>
  
  <pre><code>resource.data.number &gt; 11
  </code></pre>
  
  <p>It is <strong>not possible</strong> to compare <em>strings</em> as if they were <em>ints</em>.</p>
  
  <p>The <em>simulator</em> exception is as follows:</p>
  
  <pre><code>Unsupported operation error. Received: string &gt; int. Expected: constraint &gt; constraint, int &gt; int, float &gt; float, duration &gt; duration, timestamp &gt; timestamp, constraint &gt; any, any &gt; constraint. 
  </code></pre>
  
  <p><em>Is there a way to convert my operation to <code>int &gt; int</code>?</em></p>