[Vuejs]-Pushing Firestore document IDs to array

0👍

There is no need for ‘this’ before idArray, ‘this’ doesn’t contain an idArray so the result is ‘undefined’. Try it in this way.

function getIds() {
this.questdb.onSnapshot(function(doc) {      
  doc.forEach(doc => {
    try{
      idArray.push(doc.id);
    }
    catch(error) {
    console.log("Error: ", error);
    }              
  })
})

}

Check the Vue composition API doc for more info.
https://v3.vuejs.org/api/composition-api.html#setup

Leave a comment