0

here's my code snippets at using ejs template.

<%if(item.author == comment.user) {%>
 <%=console.log('true')%>
<%}else{%>
<%=console.log('false')%>
<%}%>

the item.author is an id object under mongodb collection the comment.user is an id object under mongodb collection

which means i am trying to compare the user id from the collection item and the comment collection if the user id is the same then it is true if not so it is false.

when i console log each one i got this id : 5ec7fabebd5cdb7409fdfec7 for both item.author & comment.user but when i do if statements or object.is() function it says false.

Please Help

ismadev
  • 73
  • 1
  • 7

0 Answers0