I am trying to create a document in a subcollection, and then delete a document in a subcollection - is there a way I can accomplish this with the functions available? Otherwise, I would like to add:
js:
createSubcollectionWithDocument(db, collectionName, docId, collectionNameTwo, docIdTwo, data) {
db.collection(collectionName).doc(docId).collection(collectionNameTwo).doc(docIdTwo).set(data)
.then(res => console.log(`${JSON.stringify(data)} is added to ${collectionNameTwo} collection`))
.catch(err => console.log('Error: ', err));
}
deleteDocumentFromSubcollection(db, collectionName, docId, collectionNameTwo, docIdTwo) {
db.collection(collectionName).doc(docId).collection(collectionNameTwo).doc(docIdTwo).delete()
.then(() => {
console.log(`${docIdTwo} successfully deleted!`);
}).catch(error => {
console.error("Error removing document: ", error);
});
}
ts:
createSubcollectionWithDocument (db: any, collectionName: string, docId: string, , collectionNameTwo: string, docIdTwo: string, data: Object): void {
db.collection(collectionName).doc(docId).collection(collectionNameTwo).doc(docIdTwo)).set(data)
.then(res => console.log(`${JSON.stringify(data)} is added to ${collectionNameTwo} collection`))
.catch(err => console.log('Error: ', err))
}
deleteDocumentFromSubcollection (db: any, collectionName: string, docId: string, collectionNameTwo: string, docIdTwo: string) {
db.collection(collectionName).doc(docId).collection(collectionNameTwo).doc(docIdTwo).delete()
.then(() => {
console.log(`${docIdTwo} successfully deleted!`);
}).catch(error => {
console.error("Error removing document: ", error);
});
}
I've actually never gone about editing a package. if you can provide the steps that would be helpful (i think maybe requesting a pull? and then commiting...to master?)
I am trying to create a document in a subcollection, and then delete a document in a subcollection - is there a way I can accomplish this with the functions available? Otherwise, I would like to add:
js:
ts:
I've actually never gone about editing a package. if you can provide the steps that would be helpful (i think maybe requesting a pull? and then commiting...to master?)