Path to the firebase service account or the config in json itself
Private
appPrivate
configPrivate
dbThis function is async, so please use await/promise syntax accordingly.
create a new document in the specified collection with the specified name if it doesn't already exist, then stores the data in the document
Modifies the data if the document already exists.
import { DB } from "node-firestore";
const db = new DB(config);
const successful = db.addData("foo", "bar", { hello: "world" });
if (!successful) {
console.error("There was an error adding data to the DB!")
}
name of the collection to add data to.
name of the document to add data to.
The data to add to the document.
true if successful or false if unsuccessful.
Private
deleteThis function is async, so please use await/promise syntax accordingly.
deletes the specified collection
import { DB } from "node-firestore";
const db = new DB(config);
const deleteCollectionSuccess = db.deleteCollection("foo");
if (!deleteCollectionSuccess) {
console.error("There was an error deleting a collection!")
}
The name of the collection to delete
The size of the batches to delete
true is successful or false if unsuccessful
This function is async, so please use await/promise syntax accordingly.
deleted the specified document in the specified collection
import { DB } from "node-firestore";
const db = new DB(config);
const deleteSuccess = db.deleteDocument("foo",
bar)
if (!deleteSuccess) {
console.error("There was an error deleting a document!");
}
The name of the collection
The name of the document
true if successful, or false if unsuccessful
This function is async, so please use await/promise syntax accordingly.
gets data from the specified document in th specified collection.
import { DB } from "node-firestore";
const db = new DB(config);
const data = db.getData("foo", "bar");
if (!data) {
console.error("There was an error retrieving data from the DB!")
}
name of the collection to add data to.
name of the document to add data to.
data if successful or false if unsuccessful
Generated using TypeDoc
Example