How do I send on object from MongoDB to jade? How do I send on object from MongoDB to jade? mongoose mongoose

How do I send on object from MongoDB to jade?


If the results are printed on the screen but you cannot traverse the object, then it may mean a few things:

1) The object might be an array i.e. results[0].whatever instead of results.whatever

2) The object is in string form and you need to call JSON.parse(results) before you can traverse it

var results = JSON.parse($('#luck').html());console.log(results.answers[2]);


Thanks for the answer @Xinzz, but this jade:

for result in results     p #{result.answers}

ended up working for me. From here: Using Jade to iterate JSON