MichaelSolati / geofirestore-js

Location-based querying and filtering using Firebase Firestore.
https://geofirestore.com
MIT License
505 stars 58 forks source link

Cloud functions: Inequality filter error after near call #150

Closed rodduenes closed 4 years ago

rodduenes commented 4 years ago

Hello! I found an interesting issue. I have the following compound query:

collection.where('startTime', '>=', fromTime).where('startTime', '<', toTime);

After deploying my cloud functions, I can make this call multiple times and it works as expected. If I make a collection.near(...) call, the compound query stops working with the following error:

Error: 3 INVALID_ARGUMENT: inequality filter property and first sort order must be the same: d.startTime and g

If I redeploy the cloud functions the behavior repeats: it works until I make the near call.

As an extra note, this doesn't happen when I emulate the cloud functions on my machine while still connecting to the same remote Firestore.

I'm using geofirestore v3.3.1

Thanks!

rodduenes commented 4 years ago

I opted to split my collections and use the geofirestore collection exclusively for the near operation to address my issue. Is this the intended usage or are there plans to support the above in the future? Thank you for your great work!

MichaelSolati commented 4 years ago

Hey @rodduenes, so yea you can't have inequality filters with geofirestore as geofirestore uses inequality filters in order to make a query and firestore doesn't support multiple inequalities. See the README.md as well as this response to a similar issue.

rodduenes commented 4 years ago

Thanks @MichaelSolati, clearly I missed that while reading the readme before