Open
Description
Firstly, thank you so much for working on this library. My apps are not possible without you guys! πββοΈ Big β€οΈ guys!
What feature would you like to see?
In my apps, there are some occasions where the queries within and()
/ or()
changes based on conditions. For example
query(
userCollection,
and(
where('happy', '>', 10),
...(minSadness !== undefined ? [where('sadness', '>', minSadness)] : []),
),
),
Currently the API wouldn't support this usecase as it will throw:
I do have a work around by wrapping the and
function:
import { and as firestoreAnd } from '@react-native-firebase/firestore';
const and: typeof firestoreAnd = (...queries) => {
if (queries.length === 1) return queries[0];
return firestoreAnd(...queries);
};
Ideally this library would supprot this?
P.S. I haven't checked, but I have the impression that this is supported in the official web modular api. (not 100% sure... don't quote me on that xD)