multi_query_firestore 1.0.0+1 multi_query_firestore: ^1.0.0+1 copied to clipboard
The best way to create multiple queries in the firestore with various conditions.
Multi Query Firestore #
Check it out at Pub.Dev
The best way to create multiple queries in the firestore with various conditions
MultiQuery(
list: [
ref.collection('A').where('count', isGreaterThan: 2),
ref.collection('B').where('size', isEqualTo: 5),
ref.collection('C').where('age', isLessThanOrEqualTo: 3)
]
).snapshots()
Help Maintenance #
I've been maintaining quite many repos these days and burning out slowly. If you could help me cheer up, buying me a cup of coffee will make my life really happy and get much energy out of it.
Getting Started #
It's simple, just create the object by passing the list of queries as in the example at the beginning.
Conditions for several #
If you want to create a condition or call a class method you can do it like this:
For all: #
MultiQuery(
list: [
ref.collection('A'),
ref.collection('B'),
ref.collection('C')
]
).where('age', isLessThanOrEqualTo: 10)
For specifics: #
All methods of the parent class Query
have a copy with the complement Only in the name, in these the parameter indexes
will be requested:
MultiQuery(
list: [
ref.collection('A'), // 0
ref.collection('B'), // 1
ref.collection('C') // 2
]
).whereOnly(
field: 'age',
// Here you pass the indexes of the queries you want to apply the filter
indexes: [
2
]
isLessThanOrEqualTo: 10
)