I have an HTML table populated with MongoDB data. I used mongoose timestamps to display a date and time for any time a DB entry is updated.
I only want the most recent date/time to be displayed, instead of a date/time for each entry that gets updated (which is currently happening because of the forEach
loop).
I'm not super familiar with mongoose so I'm wondering if there's a way to check for the most recent <%= environment.updatedAt %>
and only display that one?
HTML:
<table>
<% environments.forEach(function(environment){ %>
<%= environment.updatedAt =>
<tr>
<td><%= environment.ePIMS %></td>
<td><%= environment.codeVersion %></td>
<td><%= environment.region %></td>
</tr>
<% }); %>
</table>
let me know if you'd like to see my mongoose schema or anything else. thanks!!