My Firebase project contains multiple Firestore databases, and I need to switch between these databases in my code.
const response = await firestore().collection(collectionId).doc(savedId).get().then((doc: any) => {
console.log(doc.data(), 'doc.data()');
return doc.data();
});
This connects to the default database, but how to mention the database Id ?
I have tried to create another app instance, but even though I am not able to find any documents or articles related to switching multiple database IDs for the Firestore in react native.
In node js, I am able to switch between different databaseId within the same project.
const { Firestore } = require('@google-cloud/firestore');
var firestore = new Firestore({
projectId: projectId,
databaseId: databaseId,
keyFilename: keyFilenamePath
});