set()

You can create a data and update a data using with set()

Syntax

db.set(path,value,listener?)
  • Path; Path is a string, split with dot and required.

  • Value; All types are acceptable and required.

  • Callback; Callback is a function and not required.

Example

let user = {
    name:"John",
    surname:"Doe",
    age:18
}
db.set("user.john",user,(err,data) => {
    if(err) return console.log(err.message)
    console.log("Succesfly setted")
    console.log(data)
})
/*
{
    name:"John",
    surname:"Doe",
    age:18
}
*/

Last updated