node-firestore
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Node Firestore

Using Firestore made easier!

Install

npm install node-firestore
# OR
yarn add node-firestore
# OR
pnpm add node-firestore

Docs

Checkout the API docs @ mdxwarriorxop.github.io/node-firestore

Usage

const { DB } = require("node-firestore");
const { join } = require("path");

//OR

import { DB } from "node-firestore";
import { join } from "node:path";

const db = new DB(join(__dirname, "./my-firebase-key.json"));

// add data to the DB.
const success = db.addData("foo", "bar", {
  hello: "world",
});

// if not successful
if (!success) {
  console.error("There was an error adding data!");
}

// read data from the DB.
const data = db.getData("foo", "bar");

if (!data) {
  console.error("Error retrieving data!");
} else {
  console.log(data); //=> { hello: "world" }
}

// delete data on the DB.
const success = db.deleteDocument("foo", "bar");

if (!success) {
  console.error("Error deleting document!");
}

// delete collection on the DB
const success = firestore.deleteCollection("foo", 5);

if (!success) {
  console.error("Error deleting collection!");
}

Package Sidebar

Install

npm i node-firestore

Weekly Downloads

2

Version

2.0.1

License

MIT

Unpacked Size

13.2 kB

Total Files

13

Last publish

Collaborators

  • kingerious