Since PR #443 has been merged, the signature for Firestore.getAll() has changed from
getAll(...documents: DocumentReference[]): Promise<DocumentSnapshot[]>
to
getAll(documentRef: DocumentReference, ...moreDocumentRefsOrReadOptions: Array<DocumentReference|ReadOptions>): Promise<DocumentSnapshot[]>
with this change, we cannot use array destructuring anymore to "prepare" the refs to fetch in advance.
For example, I used to do the following:
// step 1 - select the documents to fetch
const userIDs = ...
const usersRef = admin.firestore().collection("users")
const userRefs: DocumentReference[] = userIDs.map(id => usersRef.doc(id))
// step 2 - Grab-them-all
const snaps = await admin.firestore().getAll(...userRefs)
this won't work anymore (I tried to update TS but it did not fix it), the only workaround is to do something like:
const snaps = await admin.firestore().getAll(
// extract the first item
userRefs[0],
// and then process the remaining elements
...(userRefs.slice(1))
)
Environment details
- OS: Mojave
- Node.js version: 10.12.0 (TS 3.2.2)
- npm version: 6.4.1
@google-cloud/firestore version: 0.19.0
Steps to reproduce
- Create a project with Typescript support
- Type the code above (with
.getAll(...userRefs)) → it won't compile
Edit: added #502 to restore previously-working behavior
Regards
Since PR #443 has been merged, the signature for
Firestore.getAll()has changed fromto
with this change, we cannot use array destructuring anymore to "prepare" the refs to fetch in advance.
For example, I used to do the following:
this won't work anymore (I tried to update TS but it did not fix it), the only workaround is to do something like:
Environment details
@google-cloud/firestoreversion: 0.19.0Steps to reproduce
.getAll(...userRefs)) → it won't compileEdit: added #502 to restore previously-working behavior
Regards