0

While working with the new IN operator, I just noticed that it does not work with boolean true value.

collection
    .where( 'deleted', 'in', [ true, false ] )

This only seems to return documents that have the deleted value as false. On the other hand, it works just fine when using "false" and "true" as strings, but that's not really elegant ... isn't it?

Any clue? Is there something I'm missing from the docs?

Also, another thing that doesn't seem to work is this (from the docs):

.where( 'region', 'in', [[ 'east', 'west' ]] )

This crashes the Firebase SDK saying there's an invalid value inside the query. While this is not really important, I think it's just a mispelling on Google's part.

I've reported both issues to the Firebase team, hope you guys have some insight too.

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121
Eduard
  • 3,395
  • 8
  • 37
  • 62

1 Answers1

2

Are you sure that you use the latest JavaScript SDK version (7.5.0 at the time of writing)?

Because both the pieces of code mentioned in your question work with v7.5.0.

.where( 'deleted', 'in', [ true, false ] ) does work

And

.where( 'region', 'in', [[ 'east', 'west' ]] )

or

.where( 'region', 'in', [[ 'east', 'west' ], [ 'east', 'west', 'south' ]] )

do work as well (since v7.4.0 see the doc: "The in query operator now accepts nested arrays"). However, in this case "the clause [shall] match for an exact match of array length, order, and values."

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121
  • 1
    Oh nevermind, I'm on `7.3.0` .... I'm on so many firebase projects now, I can't even recall which I've upgraded last .. I'll flag for deletion. I didn't check as I was sure I updated this project too. – Eduard Nov 26 '19 at 20:15