Thanks for explaining your schema. I believe you can make this work with Collection Group Queries [1]. The only caveat is that you also need to store the university as part of the Student document.
Query:
db.collectionGroup('Students').where('university', '==', <university>).onSnapshot(...);
Rules:
match /**/Students/ { allow list: if userIsAdminForUniversity(resource.data.university) }
There is a more complex solution if you don't want to add that field to all Student records, but the rules would be more complex (I'd need to experiment here).
db.collectionGroup('Students')
.where(FieldPath.documentId(), '>', '/University/<university>')
.where(FieldPath.documentId(), '<', '/University/<university>\0'); // note that is the null byte at the end
Note all those code snippets have not been tested so tweaks might be needed :)
Pagination is described in our docs [2].
Let me know if that would work for your use case, or if you have other questions.
-Tyler
[1]: https://firebase.googleblog.com/2019/06/understanding-collection-group-queries.html
[2]: https://firebase.google.com/docs/firestore/query-data/query-cursors
--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/032f1784-4701-4374-afec-1cdeb7ed2bb9%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/90370ecd-c861-4544-9abb-09fefd7617ff%40googlegroups.com.