I'm doing this:
res.jsonp({
userId: user._id,
spotUserId: spot.user._id,
condition: (user._id === spot.user._id)
});
And the result is this:
{
"userId": "551192836bff030fb657777c",
"spotUserId": "551192836bff030fb657777c",
"condition": false
}
I don't understand why the condition is false... Help me!
Okey, I solved the problem.
In ExpressJS for compare Mongoose ObjectsID, is .id not _id.
Example:
res.jsonp({
userId: user._id,
spotUserId: spot.user._id,
condition: (user.id === spot.user.id)
});
Result:
{
"userId": "551192836bff030fb657777c",
"spotUserId": "551192836bff030fb657777c",
"condition": true
}