Firebase orderByPriority used with equalTo strange behavior
<p>I try to use the second argument of <code>equalTo(value, key)</code> when using <code>orderByPriority()</code>, as <a href="https://firebase.google.com/docs/reference/js/firebase.database.ThenableReference?hl=da#equalTo" rel="nofollow noreferrer">documented here</a>.</p>

<p>The problem is that results are inconsistent when using that second <code>key</code> argument.</p>

<hr>

<p><strong>Example dataset</strong></p>

<pre><code>items
  key1
  key2
  key3
  key4
</code></pre>

<p><em>All items have the same priority: 10 (this is just for the example, in my app there are other items with other priorities)</em></p>

<hr>

<p>When issuing the following Firebase query to get the first two items with that priority: </p>

<pre><code>dbRef.child('items').orderByPriority().equalTo(10).limitToFirst(2)
</code></pre>

<p>I get the following - expected - results :</p>

<pre><code>{ "key1": ..., "key2": ... }
</code></pre>

<hr>

<p>Then I try to get the results after the <code>key2</code> item, as explained in the docs:</p>

<pre><code>dbRef.child('items').orderByPriority().equalTo(10, 'key2').limitToFirst(2)
</code></pre>

<p>Result is pretty strange, with always only one item, the one with the provided key:</p>

<pre><code>{ "key2": ... }
</code></pre>

<p>What i was expecting is two results <em>starting at</em> or <em>after</em> the key provided, so </p>

<pre><code>{ "key2": ..., "key3": ... }
</code></pre>

<p>Or</p>

<pre><code>{ "key3": ..., "key4": ... }
</code></pre>

<hr>

<p><strong>Question</strong></p>

<p>How should I use the <code>equalTo()</code> filter with its second argument?</p>

<hr>

<p><em>It seem this question was <a href="https://stackoverflow.com/questions/35140189/combine-orderbypriority-with-equalto">already asked</a>, but it did not get any answers...</em> </p>