firestoreImport() throws Cannot read property 'batch' of undefined
tohagan opened this issue · 1 comments
tohagan commented
Expected behavior
firestoreImport() API should import a collection from an exported JSON file.
Actual behavior
firestoreImport()
call failed with an exception
Steps to reproduce the behavior
-
exported an "events" collection from an instance of Firestore.
-
Running a unit test with ...
const col = db.collection("events");
const events = require("../../fixtures/events.json");
await firestoreImport(col, events); // << throws TypeError: Cannot read property 'batch' of undefined -
In the debugger I found that ...
This line inimports.ts
executesconst batch = startingRef.firestore.batch();
butstartingRef.firestore
is undefined.
tohagan commented
My bad! Arguments were swapped.