0.6.0 • Published 4 years ago

jdbx v0.6.0

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

What is this module?

This module is a simple local json database good for small projects and very simple games

Installation

npm install jdbx

Setup

const { Database } = require("jdbx");

const db = new Database(__dirname, "dbName")

Functions

Collection

A method that must start before other methods That gets the currenct collection

db.collection("NAME")

Insert

A method that pushs an object to the collection

db.collection("NAME").insert({
    name:"Tom",
    age:42,
    email:"email@email.com"
})

props

_propdatatypeoptionsdescription
_timesNumber_Number of times to insert the data

Get

A method that gets data of a certain condition

Conditon get

db.collection("NAME").get({name:"Tom"}, (err, data) => console.log(data))

All get

db.collection("NAME").get({}, (err, data) => console.log(data))

props

_propdatatypeoptionsdescription
_typeStringone, allreturns all data or the first index of the data
_indexNumber_returns an index of a entry

Update

A method that overwrite a existing entry with the to param

Two params (from, to)

db.collection("NAME").update({name:"Tom"}, {name:"Bill"})

Remove

A method that Delets an entry, entries, collection

One Entry Remove

db.collection("NAME").remove({name:"Tom"})

All Entries Remove

db.collection("NAME").remove({name:"Tom", _all:true})

Collection remove

db.collection("NAME").remove({_force:true})
_propdatatypeoptionsdescription
_forceBoolean_Deletes a the collection if set to true
_allBoolean_Deletes all entries that match the condition if set to true

Props usage

db.collection("NAME").method({_prop})
0.6.0

4 years ago

0.5.0

4 years ago

1.0.1

4 years ago

0.0.5

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago