Pregunta

mymodel.find ({}, function (err, modelos) {

console.log (modelos.tojson ()); // Error: el objeto no tiene método tojson

})

¿Fue útil?

Solución

Casi lo tiene, pero necesita usar JSON.Stringify () en lugar de TOJSON ():

myModel.find({}, function(err, models){
  console.log(JSON.stringify(models));
})
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top