2.1.2 • Published 1 year ago

iojdb v2.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago
const JsonDB = require("iojdb");

const db = JsonDB("./path/to/JsonDB-Data/");

JsonDB(path/to/database/folder)
    .open(collName) - open and create collection
        .insert([documentObject]) - number of docs inserted
        .find(queryObject) - array of docs found
        .findOne(queryObject) - doc if found or false
        .update(queryObject, updatedDocumentObject) - number of docs updated
        .remove(queryObject) - number of docs removed
        .destroy() - destroy the collection and its data
    .get(collName) - get collection if exists
    .list() - list all collection names
    .exist(collName) - check if collection exists
    .delete(collName) - delete existing collection
    .destroy() - destroy the database and its data

const coll = db.open("CollectionName");

let DocumentObject = {
    first_name: "John",
    last_name: "Silver",
    num: 88,
    tf: false,
    nu: null,
}
let QueryObject = {
    first_name: "John",
    last_name: (v) => v.startsWith("S"),
};

let insertCount = coll.insert([DocumentObject]);
let documentObjectArray = coll.find(QueryObject); // [DocumentObject]
let updateCount = coll.update(QueryObject, { num: 77 });
let documentObject = coll.findOne(QueryObject); // DocumentObject, but with num = 77
let removedCount = coll.remove(QueryObject);
2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago