grahamearley/FirestoreGoogleAppsScript

Firestore query does not accept "!=" operator

Closed this issue · 2 comments

Minimal code to reproduce the problem

const firestore = FirestoreApp.getFirestore(email, key, projectId);
const allData = firestore.query("table")
    .Where("availability", "!=", "")
    .Execute();
Logger.log(allData);

Expected Behavior

  • Return user documents that fulfill query - ie exclude documents where the availability field is null

Actual Results

image

Library Version:

33

Made do with a workaround:

const allData = firestore.query("table")
    .Where("availability", ">", "")
    .Execute();

We just try to translate the original API, and the != and not null are not part of the spec.

I was going to suggest that you try the > "" approach, but seems like you found it!