3.0.2 • Published 10 months ago

doodledb v3.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

DoodleDB

DoodleDB is a lightweight package that allows you to utilize JSON files as databases

Table of Contents:

Installation

To install DoodleDB, run the following command:

npm install doodledb

Usage

  1. Import the class into your Node.js application
import { DoodleDB } from "doodledb";
  1. Instantiate the class with the path to the JSON file
const database = new DoodleDB({ filePath: "database.json" });
  1. Use DoodleDB's many functions to manipulate the database!

Functions

For detailed documentation of every method on the DoodleDB class, visit our GitHub Docs Page

Examples

push

Add new data to the JSON file

database.push({ filePath, collectionName, data })
  .then((successMessage) => {
    console.log(successMessage);
  })
  .catch((error) => {
    console.error(error);
  });

get

Retrieve data from the JSON file based on search criteria.

database.get({ filePath, collectionName, searchQuery: data })
  .then((foundData) => {
    console.log(foundData);
  })
  .catch((error) => {
    console.error(error);
  });

getCollection

Retrieve an entire collection from the JSON file

database.getCollection({ filePath, collectionName })
  .then((dataCollection) => {
    console.log(dataCollection);
  })
  .catch((error) => {
    console.error(error);
  });

deleteCollection

Delete an entire collection from the JSON file

database.deleteCollection({ filePath, collectionName, targetID })
  .then((successMessage) => {
    console.log(successMessage);
  })
  .catch((error) => {
    console.error(error);
  });

delete

Delete specific fields from a data entry in the JSON file

database.delete({ filePath, collectionName, targetID, deleteObject })
  .then((successMessage) => {
    console.log(successMessage);
  })
  .catch((error) => {
    console.error(error);
  });

createIndex

Create an index for faster searching.

database.createIndex({ filePath, collectionName, fieldName })
  .then((successMessage) => {
    console.log(successMessage);
  })
  .catch((error) => {
    console.error(error);
  });

Q&A

Discord Server

License

This project is under the MIT license. Read more about this license at LICENSE

3.0.2

10 months ago

3.0.1

10 months ago

3.0.0

10 months ago

2.0.0

10 months ago

1.1.2

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago