How to save in firestore using python, a document with exactly type reference
I know in js, you can doing something like this:
let data = {
name: 'productName',
size: 'medium',
userRef: db.doc('users/' + firebase.auth().currentUser.uid)
};
db.collection('products').add(data);
userRef being the reference.
what's in python the way to doing:
db.doc('users/' + firebase.auth().currentUser.uid)
Passing the document reference as the value in set() works. Example:
reference = db.collection('Company').document('Apple')
db.collection('Product').document('iPhone').set({"company_id":reference},merge=True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With