I want to add usersOrderInfo collection inside users document.I tried this way:
db
.collection('shopDB')
.doc(user.uid)
.collection("userOrderInfo")
.doc(paymentInfo.id)
.set({
orders:basket,created:paymentIntent.created},{merge:true})
But this throw an error :
Uncaught (in promise) TypeError: _firebase__WEBPACK_IMPORTED_MODULE_7__.db.collection is not a function
I am using firebase version 10.5.0
The set() takes data of document as parameter. Try refactoring the code as shown below:
db
.collection('shopDB')
.doc(user.uid)
.collection("userOrderInfo")
.doc(paymentInfo.id)
.set(DOC_DATA)
Also do ensure that no field is undefined.