Buzdolabi
First Version Released!
- The first version of the Buzdolabi database is online. Now available.
Examples
(QuickDB) Moving Everything to Buzdolabi
const ayran = require("buzdolabi");
const quickdb = require("quick.db");
await ayran.move(quickdb)
(JsonDB) Moving Everything to MongoDB
const ayran = require("buzdolabi");
ayran.setAdapter("mongo", {url: "YOUR_MONGO_URL"})
const JsonDB = require("../your_file.json");
ayran.moveToMongo(JsonDB)
Example
const ayran = require("buzdolabi")
ayran.set("x.y.z", "abc") // abc
ayran.get("x") // {y: {z: "abc"}}
ayran.fetch("x") // {y: {z: "abc"}}
ayran.all() // {x: {y: {z: "abc"}}}
ayran.push("a", "hello") // ["hello"]
ayran.push("a", "world") // ["hello", "world"]
ayran.unpush("a", "hello") // ["world"]
ayran.push("b", {test: "ayran"}) // [{test: "ayran"}]
ayran.push("b", {test2: "ayran2"}) // [{test: "ayran"}, {test2: "ayran2"}]
ayran.delByPriority("b", 1) // [{test2: "ayran"}]
ayran.setByPriority("b", {newtest:"hey this is edited"}, 1) // [{newtest:"hey this is edited"}]
ayran.has("x") // true
ayran.delete("x") // true
ayran.deleteAll() // true
MongoDB Support (It is new feature, if you find any bugs join my Discord)
const ayran = require("buzdolabi")
ayran.setAdapter("mongo",
{
url: "Your Mongo URL",
schema: "Schema Name" // Not required. You can't define your own schema. Just name.
})
await ayran.set("x.y.z", "abc") // abc
await ayran.get("x") // {y: {z: "abc"}}
await ayran.fetch("x") // {y: {z: "abc"}}
await ayran.all() // {x: {y: {z: "abc"}}}
await ayran.push("a", "hello") // ["hello"]
await ayran.push("a", "world") // ["hello", "world"]
await ayran.unpush("a", "hello") // ["world"]
await ayran.push("b", {test: "ayran"}) // [{test: "ayran"}]
await ayran.push("b", {test2: "ayran2"}) // [{test: "ayran"}, {test2: "ayran2"}]
await ayran.delByPriority("b", 1) // [{test2: "ayran"}]
await ayran.setByPriority("b", {newtest:"hey this is edited"}, 1) // [{newtest:"hey this is edited"}]
await ayran.has("x") // true
await ayran.delete("x") // true
await ayran.deleteAll() // true
Example With Options
const ayran = require("ayran")
ayran.setReadable(true) // It makes readable your JSON DB file.
ayran.noBlankData(true) // If you delete anything from object and new object size is less than 1, automaticly removes that object.
ayran.setAdapter("yamldb") // It makes adapter as YAML adapter. Default adapter is JsonDB
ayran.setFolder("folder") // You can set database folder name
ayran.setFile("db") // You can set database file name
ayran.setCheckUpdates(true) // It warns you if any updates happens.
ayran.set("x.y.z", "abc") // abc
ayran.get("x") // {y: {z: "abc"}}
ayran.fetch("x") // {y: {z: "abc"}}
ayran.all() // {x: {y: {z: "abc"}}}
ayran.push("a", "hello") // ["hello"]
ayran.push("a", "world") // ["hello", "world"]
ayran.unpush("a", "hello") // ["world"]
ayran.push("b", {test: "ayran"}) // [{test: "ayran"}]
ayran.push("b", {test2: "ayran2"}) // [{test: "ayran"}, {test2: "ayran2"}]
ayran.delByPriority("b", 1) // [{test2: "ayran"}]
ayran.setByPriority("b", {newtest:"hey this is edited"}, 1) // [{newtest:"hey this is edited"}]
ayran.has("x") // true
ayran.delete("x") // true
ayran.deleteAll() // true
If you've any question, you can join to my Discord server: Click me! This database was made with croxydb's codes.