I want to save my field values into a local array.
Example:
I will get ["84724302","60855802"]
And by the way the field name is not 0
& 1
.
When I'm trying to do it with documentSnapshot.data() it returns this result:
[{"field_name": "84724302", "field_name": "60855802"}]
But I need to get this result: ["84724302","60855802"]
CodePudding user response:
just convert the object that you are getting to an array
firestore.collection('collection').doc('123').onSnapshot(doc=>{
const arr=Object.values(doc.data())
console.log(arr) // ["84724302","60855802"]
//...
})