📜
WastefulDB Docs
WastefulDB
WastefulDB
  • Constructor Setup
  • Specifying Directories
  • Retrieval Functions
  • Document Functions
Powered by GitBook
On this page
  • .find(id)
  • .findMore([ids]);
  • .get(id);
  • .collect();

Retrieval Functions

The purpose of these functions are primarily to retrieve documents within the given (or default) directory.


.find(id)

Retrieves a document based on the document name, or the "id", and returns the results, parsed and contained in an array. Returns -1 if the document couldn't be found.

let info = db.find("1234");
console.log(info);

.findMore([ids]);

Retrieves multiple documents at the same time based on the identifiers provided in an array. Results are returned in an array, and documents that couldn't be found are returned as -1.

db.findMore(["1234", "2", "5555"]);

.get(id);

Retrieves a document based on the internal identifier. Rather than searching for a document name, this function will open and read each file's "id" key and return the proper document.

db.get("1234", (file) => {
    console.log(file);
});

.collect();

Retrieves every document in the specified or default directory, parses, and returns an array containing each document and its contents.

let data = db.collect();
console.log(data);

PreviousSpecifying DirectoriesNextDocument Functions

Last updated 10 months ago