Q:

how to handle find in mongodb if condition fail

collection.findOne({query}, function(err, result) {
    if (err) { /* handle err */ }

    if (result) {
        // we have a result
    } else {
        // we don't
    }
}
0

New to Communities?

Join the community