findOne()
Find the first item that matches the filter
Example
db.collection("users").findOne({
    _id: "t4m1s8kuw3445ros7zz682no52e9lj91"
}).then(item => {
    console.log(item);
    /*
        item output => {
            _id: "t4m1s8kuw3445ros7zz682no52e9lj91",
            banned: false,
            accountCreated: "13/02/2023",
            example1: "example1",
            example2: "example2",
        };
    */
}).catch(error => {
    console.log("error:", error);
});findOne(<filter>)
Parameter
Description
filter
Query for find Operation
Last updated
Was this helpful?