Modifying Data

Declaring Variable

const FlameDB = require("flame.db");
const db = new FlameDB();

Methods

  • db.create(path, value)

  • db.set(path, value)

  • db.update(path, value)

  • db.push(path, value)

create(path, value)

This will create a new collection and documents.

// Create a new collection -- {balance: 1000, coins: 12000}
db.create("users/566851016910438400", {balance: 1000, coins: 12000})

set(path, value)

Modify the whole document data. This is different than the update method

// Modify the whole document data -- {balance: 1000, money: 12000}
db.set("users/566851016910438400", {balance: 1000, money: 12000})

update(path, value)

Modify only the specified field in the document data

push(path, value)

Push item into an array inside the document

Last updated