javascript – Node JS and Firebase Firestore add/update operations on array of references
I’m new to firestore and I have users collection and addresses collection, and user have array of references of address. But not able to add, update array of reference.
const userRef = getFirestore()
.collection(FirebaseCollections.USERS)
.doc(userId);
const result = await getFirestore()
.collection(FirebaseCollections.ADDRESSES)
.add(address);
const userAddressRef = userRef.collection(FirebaseCollections.ADDRESSES);
const refPath = `${FirebaseCollections.ADDRESSES}/${result.id}`;
const refId = userAddressRef.doc(refPath); << CREATING REF
await userAddressRef.add(refId); << ADDING IT TO ARRAY OF ADDRESS
it gives error
"Value for argument \"documentPath\" must point to a document, but was \"addresses/LWELWL3goUA5ba8QjHSj\". Your path does not contain an even number of components.",
What’s the correct way to do that?
Read more here: Source link

