Array-Membership query operators do not match Firebase operators
Closed this issue · 2 comments
marcusljx commented
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
- Able to use Firebase operators
in
,not-in
,array-contains-any
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:
LaughDonor commented
Have you tried using contains_any
operator instead of array-contains-any
?
LaughDonor commented
Closing due to inactivity, please continue the discussion as necessary, @marcusljx.