Giter Site home page Giter Site logo

doodledb's Introduction

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

What are IDs? Each object within a collection has an ID value. This value increases depending on its order in the array. If it is at position one, the ID will be 1.

Discord Server

License

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

doodledb's People

Contributors

naaaahthedev avatar pineapplerind avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.