Reputation: 31
When I try to create an array in firestore with this code
await store
.collection("video")
.doc(videoId)
.set(
{
data: firebase.firestore.FieldValue.arrayUnion(userId),
},
{merge: true},
)
The data created in firestore then look like
Upvotes: 2
Views: 944
Reputation: 31
This behavior appear because I was using firestore from @react-native-firebase/firestore and importing firebase from firebase library instead of @react-native-firebase/app so i had to change this
import firebase from "firebase"
To this
import firebase from "@react-native-firebase/app"
Upvotes: 1
Reputation: 1236
First, omit the trailing comma after {merge:true}
.
If that doesn't fix it, can you share how you define "userId" and "store"?
Upvotes: 0