on my site, when a section is deleted I want all items in that section removed so I am using a transaction
const sectionRef = db
.collection('items')
.where('subSection', '==', sectionName);
db.runTransaction((transaction) => {
return transaction
.get(sectionRef)
.then((data) => {
data.docs.map((doc) => {
transaction.delete(doc);
});
})
.catch((e) => {
console.log('transaction failed', e);
});
});
};
i am getting the following error
(FirebaseError): Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?
here is the firebase config
firebaseConfig = {
apiKey: process.env.REACT_APP_PROD_API_KEY,
authDomain: process.env.REACT_APP_PROD_AUTH_DOMAIN,
projectId: process.env.REACT_APP_PROD_PROJECT_ID,
storageBucket: process.env.REACT_APP_PROD_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_PROD_MESSAGING_SENDER_ID,
appId: process.env.REACT_APP_PROD_APP_ID,
measurementId: process.env.REACT_APP_PROD_MEASUREMENT_ID,
};
const firebaseApp = firebase.initializeApp(firebaseConfig);
const db = firebaseApp.firestore();
can anyone see the issue?