grahamearley / FirestoreGoogleAppsScript

A Google Apps Script library for accessing Google Cloud Firestore.
http://grahamearley.website/blog/2017/10/18/firestore-in-google-apps-script.html
MIT License
648 stars 109 forks source link

Array-Membership query operators do not match Firebase operators #128

Closed marcusljx closed 2 years ago

marcusljx commented 3 years ago

Minimal code to reproduce the problem

const firestore = FirestoreApp.getFirestore(email, key, projectId);

firestore.query('my_collection')
  .Where('document', 'array-contains-any', ['abc'])
  .Execute()

Expected Behavior

Actual Results

FirestoreGoogleAppsScript Library returns error:

Error: Invalid Operator given: array-contains-any
filter_ @ Query.gs:111
Where   @ Query.gs:155

On perusing the FirestoreGoogleAppsScript README, the supported operators appear out of date: [contains, contains_any, in].

Attempting the same with contains or contains_any results in Firebase returning an error instead:

Error: Only a single 'IN', 'NOT_IN', or 'ARRAY_CONTAINS_ANY' filter allowed per query.
checkForError   @ Request.gs:138
method_ @ Request.gs:50
post    @ Request.gs:95
callback    @ FirestoreRead.gs:115
Execute @ Query.gs:241
Library Version:

FirestoreApp (version 33)

LaughDonor commented 3 years ago

Have you tried using contains_any operator instead of array-contains-any?

LaughDonor commented 2 years ago

Closing due to inactivity, please continue the discussion as necessary, @marcusljx.