Data Request

All methods below will return a promise

Declaring Variable

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

Methods

  • db.get(path)

  • db.getCollection(collection)

get(path)

This will return all fields inside the documents in json

db.get("users/566851016910438400").then(data => {
    // {balance: 2000, money: 12000, items: ["Laptop"]}
})

getCollection(collection)

This method will returns an array of documents inside the specified collection

db.getCollection("users").then(data => {
    {id: 566851016910438400, data: {balance: 2000, money: 12000, items: ["Laptop"]}}
})

Last updated