findById()

Find data by ID

User.findById("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",(err, data) => {
    if(err) {
        console.log(err.message)
    } else {
        console.log(data);
        //example answer
        /*
            {
                name:"John",
                age:18,
                hair: {
                    color:"blue",
                    size:"short"
                }
            }
        */
    }
})

Last updated