How to map JSON coming from Mongoose to Vue and Quasar? How to map JSON coming from Mongoose to Vue and Quasar? mongoose mongoose

How to map JSON coming from Mongoose to Vue and Quasar?


If I understand correctly, donvis is the data from mongoose, which is an object.Objects don't have a length property

You should try this:

donvis.kinder.forEach(child => {  treeNodes.push({    fachlicherTyp: child.fachlicherTyp,    _id: child._id,    lazy: true,    parent_id: parent_id,  })})

I'm using forEach because I think it makes things more readable. Tell me if you don't know how to use it.

Notice that I'm also using treeNodes.push(...) instead of treeNodes[i] = ... This is a more standard way of filling up an array