Filtering a Firestore collection with a number field, using condition type "equal" returns an error

I’m using the Firebase Connector and trying to query the following “favorites” collection using a filter condition.

When I filter by userID (string field) and condition type is “equal” the results are as expected.

When I filter by itemID (number field) and condition type is “equal”, “Get Record Collection” fails with the following error: “TypeError: n.toLowerCase is not a function”.

The error is returned even if the number in the filter is static instead of using a dynamic variable

The strange thing is, if I change the condition type to “greater” the query works as expected.

If I change the data type of of itemID from number to string in Firestore and Appgyver the search will work as expected but this is obviously a hack and should be avoided if possible.

Help anyone.

Hi, thanks for reporting this, we’ll look into it.

Edit: Confirmed as a bug, we’re working on a fix :slight_smile:

Thanks Mari for confirming the bug!

To filter a number field in a Firestore document until Appgyver fix the bug and without compromising your data structure one can use the following technique…

image

In this case params.id contains the number I need to filter itemID by (itemID “equal” params.id). Instead of a “equal” condition (which currently fails) I use 2 conditions, “greater” than params.id - 1 and “less” than params.id + 1. Silly but it works.

If I use OP’s data structure, how will the read count from Firebase be like?

Let’s say if I have 100 documents from different users, 5 of those contain a userID called “exampleUserID”.

Using Appgyver’s “filter condition” to get documents that contain “exampleUserID”, does it have to read through all 100 documents (i.e. 100 read counts), or just 5 read counts?