Failing while comparing params on express (get request)

I'm using express 3.0 and when I'm trying to resolve some queries I want to test if there's other component on the db that match these id's. Any way, this is the code I'm not getting to work:

function(req, res) {
 var Parking = mongoose.model('Parking');
 var parkingId = req.params.id;
 var userId = req.user['_id'];
 Parking
    .findOne({'_id': parkingId}, function(err, parking) {
        var parkingUserId = parking.userId;
        if (userId == parkingUserId) {
                       ...
                    } else {
                       ...
                    }

req.params.id is inside url and req.user['_id'] comes from a middleware.

Although I'm calling this url with the same id on both fields.... it keeps getting false...

Why I'm doing wrong? thanks!

You need to convert parkingUserId from a bson ObjectId object to a string:

if (userId.toString() == parkingUserId.toString())