I'm trying to check the values of 2 objects, one which the mongoose returns and one which passport js returns.
app.get('/user-area', isLoggedIn, function(req, res){
User.find({}, function(err, users){
if(err) throw err;
res.render('admin/user-area/allUsers', {
user: req.user,
users: users,
logged_user: req.user._id
});
});
});
in the above code, i'm parsing the values to the ejs file, on the ejs file i'm doing a simple comparison to filter out some data.
<ul>
<%for(var i = 0; i < users.length; i++){%>
<%if(logged_user != users[i]._id){%>
<li><%=users[i].local.username%></li>
<%}%>
<%}%>
</ul>
I'm trying to filter out the logged in user from printing to the screen using the simple if statement, when printed on screen as a string, they seem to be exactly the same but for a reason I cannot find out, they fail on the if statement,