I'm sending data over to my ejs files from my app.js file, and it looks like this:
{ _id: 2500, firstName: 'John', lastName: 'Doe', comments: [ { _id: 5555, title: "Hello", comment: "Hello, World" } ], __v: 0 }
When using a forEach loop, I can print out the entire document using <%= document %>.
I can print out the first and last name using <%= document.firstName %>.
When I use <%= document.comments %> it prints out the object, but I want it to print out only the "comment" string. I tried using <%= document.comments.comment %>, but nothing gets printed.
How do I access specific data in embedded objects?