vedartm / paginate_firestore

A flutter package to simplify pagination with firestore data 🗃
https://pub.dev/packages/paginate_firestore
MIT License
113 stars 136 forks source link

multi-query support to deal with Firestore 10 limit when using IN operator #58

Open azazadev opened 3 years ago

azazadev commented 3 years ago

Hi @excogitatr

it's possible to support List<query> to WA Firestore 10 limit when using IN operator ref : https://ncona.com/2021/01/dealing-with-firestore-10-limit-with-in-operator

this will save the live of anyone use firestore !!!

vedartm commented 3 years ago

Hey @azazadev. Can you elaborate on the feature you are talking about?

fazaza commented 3 years ago

take this example :

collections :
posts 
    - id
    - message
    - date
    - userId
    - ...
    - ...

users :
    - userId
    - name
    - ...
    - ...

scenario : user have 100 friends

Expected : paginate view with all posts of 100 friends

PaginateFirestore( query: FirebaseFirestore.instance.collection('posts').Where("userId", "in", friends (list of 100 ids )) ---> this will not work due to Firestore 10 limit when using IN operator

Expected :

PaginateFirestore(
 // split list of friends in batch of 10 and run with multiple queries
 queries: [FirebaseFirestore.instance.collection('posts').Where("userId", "in", friends (list of 10 ids )),FirebaseFirestore.instance.collection('posts').Where("userId", "in", friends (list of 10 ids )) .... ]
Nader2004 commented 3 years ago

is there any update on this feature

vedartm commented 3 years ago

If you guys are comfortable with using documentSnapshots directly, you can go with the package pagination_view. I made it for a general use case.