firebase / firebase/firebase-ios-sdk
FR: Add something like batchGet to Firestore SDK
- Dominant language
- C++
- Stars
- 6.7k
- Forks
- 1.8k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
* Xcode version: 10.0 (10A255)
* Firebase SDK version: 5.7.0
* Firebase Component: Firestore
* Component version: 0.13.2
Sometimes one comes in the situation where you get back multiple document from a query and each document has a reference saved in the field.
Now you want to get those (and only those documents), want you end up doing is either:
- loop over the array of references and get each individually and try to somehow keep track if every document was already fetched and then call another function
- or if you know that every reference is in one collection to query every document in this collection (and probably query too much data) and after you got all documents you match the queried documents with the reference array.
Both are not the most ideal ways so I looked for an alternative, I knew that there were batches, but they are only for writing, so I dig deeper and ended up at this Firestore REST API page:
There is a function called `batchGet` https://firebase.google.com/docs/firestore/reference/rest/v1beta1/projects.databases.documents/batchGet
As far as I know this function is not yet implemented in the Firestore SDKs and there is no open issue for that.
Is there any issue with the offline functionality of Firestore and because of that this is not implemented?
Contributor guide
Research direction
Start with the Firestore SDK's existing read and query entry points, then compare them with the linked REST batchGet reference and investigate the offline-functionality concern. Done means the SDK offers an equivalent way to retrieve the referenced documents without per-document reads or an overbroad collection query, with behavior defined for offline use.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- firebase, ios
- Domain
- databases, mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100