Thursday, 18 May 2017

How to make EJS show only one document inside an array of documents?

Below is the EJS code I am using to show the data.

<p class="text-center">Details : <%= user.transactions %></p>

When I put in the above code in my EJS, the result is it prints all the documents inside the the "transactions" array document.

Details : { date: Thu May 18 2017 11:29:38 GMT+0000 (UTC), credit: 125000, debit: 120000, _id: 591d85a2a86f562d7dcacfd1, description: 'The first post', billno: 123 }

How do I make it to only print a particular item like debit or credit or bill number in the page and not the whole array documents?I tried "user.transactions.billno" but it doesn't seem to work. Can someone help me with this? Thanks in advance



via Hisham Mubarak

No comments:

Post a Comment