Firebase optional query elements

Hi there. I understand with SQL, we can prepend ! to the variable to make the WHERE clause optional. How can the same be achieved with Firebase? My UI needs to "clear" the user's filter and I can't find a way to make that happen with a Firebase datasource.

1 Like

I'm also curious about this. There doesn't seem to be a way to specify if a where clause should be added in the query. Using Firebase's admin SDK and Retool's beta feature for "Firebase Raw Queries" we can do the following:

let query = db.collection("someCollection");
if (value1) query = query.where("value1", "==", value1);
if (value2) query = query.where("value2", "==", value2);
await query.get();

But Firebase Cloud Functions limits responses to 10MB and the raw queries limit us to 6MB, which isn't really ideal when dealing with large amounts of data.

Are there any plans to increase the limit once it's out of beta, or even add an optional toggle for each where clause?


Hey there, noting your feedback :wave: . At the moment there are no changes in the works for the beta feature Firebase Raw Queries. Because of that I will move this to our feature requests :slightly_smiling_face: