Monday 26 November 2018

Help me to understand this code :(

i understand why this workrouter.get('/', (req, res) => { item.find() .sort({date: -1 }) //desc order .then(result => res.json(result)) //callback }); but how this isn't working?router.get('/', (req, res) => { result = item.find() res.json(result) }); i'm getting a "Converting circular structure to JSON" error, i'm very new to node js, and i really want to understand more of it, btw i also want to know, how do i count all the elements of the query?, thanks in advance

Submitted November 26, 2018 at 06:56PM by Vasault

No comments:

Post a Comment