It's been a while since I used firebase and it looks like things have changed. Previously, I could do something like this (using method chaining):
const app = firebase.initializeApp(firebaseConfig);
const db = app.firestore();
const itemQuerySnapshot = db
.collection('companies')
.doc(data.userData.company)
.collection('items')
.get()
But now, it seems that's no longer supported (or perhaps the Typescript typings have changed for the latest version). With the latest version, method chaining appears out of the picture.
So my question is: which version of firebase supports the kind of method chaining shown in the code above so that I can downgrade to it. I'd also appreciate it if someone can help explain the benefits (if any) of the current pattern used in the latest version of firebase.
CodePudding user response:
It's not completely clear from your question, but I'm assuming you've upgraded to v9 of the SDK, which uses a new modular syntax.
If you want to use the new SDK with the older syntax, you can use its compat
modules as explained here.
If you want to stick to the older SDKs entirely, the 8.x are the latest SDK versions that support the older syntax.
I recommend reading more about the new modular SDKs here: