Answers for "how to handle find in mongodb if condition fail"

0

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
    }
}
Posted by: Guest on May-29-2020

Code answers related to "how to handle find in mongodb if condition fail"

Browse Popular Code Answers by Language