Package Exports
- erenaydb
- erenaydb/file/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (erenaydb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ErenayDB
What's New In 0.0.4?
Fixed MongoDB Unpush method
Updated Logging System
And some bugs fixed
Examples
(QuickDB) Moving Everything to ErenayDB
const db = require("erenaydb");
const quickdb = require("quick.db");
await db.move(quickdb)(JsonDB) Moving Everything to MongoDB
const db = require("erenaydb");
db.setAdapter("mongo", {url: "YOUR_MONGO_URL"})
const JsonDB = require("../your_file.json");
db.moveToMongo(JsonDB)Example
const db = require("erenaydb")
db.set("x.y.z", "abc") // abc
db.get("x") // {y: {z: "abc"}}
db.fetch("x") // {y: {z: "abc"}}
db.all() // {x: {y: {z: "abc"}}}
db.push("a", "hello") // ["hello"]
db.push("a", "world") // ["hello", "world"]
db.unpush("a", "hello") // ["world"]
db.push("b", {test: "erenaydb"}) // [{test: "erenaydb"}]
db.push("b", {test2: "erenaydb2"}) // [{test: "erenaydb"}, {test2: "erenaydb2"}]
db.delByPriority("b", 1) // [{test2: "erenaydb"}]
db.setByPriority("b", {newtest:"hey this is edited"}, 1) // [{newtest:"hey this is edited"}]
db.has("x") // true
db.delete("x") // true
db.deleteAll() // trueRethinkDB Supporting! (If you find any bugs/issues join my Discord)
const db = require("erenaydb")
db.setAdapter("rethink",
{
host: "localhost",
port: 28015,
db: "HarenUptime",
schema: "Schema Name" // Not required. You can't define your own schema. Just name.
})
await db.set("x.y.z", "abc") // abc
await db.get("x") // {y: {z: "abc"}}
await db.fetch("x") // {y: {z: "abc"}}
await db.all().then((result) => console.log(result)) // {x: {y: {z: "abc"}}}
await db.push("a", "hello") // ["hello"]
await db.push("a", "world") // ["hello", "world"]
await db.unpush("a", "hello") // ["world"]
await db.push("b", {test: "erenaydb"}) // [{test: "erenaydb"}]
await db.push("b", {test2: "erenaydb2"}) // [{test: "erenaydb"}, {test2: "erenaydb2"}]
await db.delByPriority("b", 1) // [{test2: "erenaydb"}]
await db.setByPriority("b", {newtest:"hey this is edited"}, 1) // [{newtest:"hey this is edited"}]
await db.has("x") // true
await db.delete("x") // true
await db.deleteAll() // trueMongoDb! (If you find any bugs/issues join my Discord)
const db = require("erenaydb")
db.setAdapter("mongo",
{
url: "Your Mongo URL",
schema: "Schema Name" // Not required. You can't define your own schema. Just name.
})
await db.set("x.y.z", "abc") // abc
await db.get("x") // {y: {z: "abc"}}
await db.fetch("x") // {y: {z: "abc"}}
await db.all() // {x: {y: {z: "abc"}}}
await db.push("a", "hello") // ["hello"]
await db.push("a", "world") // ["hello", "world"]
await db.unpush("a", "hello") // ["world"]
await db.push("b", {test: "erenaydb"}) // [{test: "erenaydb"}]
await db.push("b", {test2: "erenaydb2"}) // [{test: "erenaydb"}, {test2: "erenaydb2"}]
await db.delByPriority("b", 1) // [{test2: "erenaydb"}]
await db.setByPriority("b", {newtest:"hey this is edited"}, 1) // [{newtest:"hey this is edited"}]
await db.has("x") // true
await db.delete("x") // true
await db.deleteAll() // trueExample With Options
const db = require("erenaydb")
db.setReadable(true) // It makes readable your JSON DB file.
db.noBlankData(true) // If you delete anything from object and new object size is less than 1, automaticly removes that object.
db.setAdapter("yamldb") // It makes adapter as YAML adapter. Default adapter is JsonDB
db.setFolder("folder") // You can set database folder name
db.setFile("db") // You can set database file name
db.setCheckUpdates(true) // It warns you if any updates happens.
db.set("x.y.z", "abc") // abc
db.get("x") // {y: {z: "abc"}}
db.fetch("x") // {y: {z: "abc"}}
db.all() // {x: {y: {z: "abc"}}}
db.push("a", "hello") // ["hello"]
db.push("a", "world") // ["hello", "world"]
db.unpush("a", "hello") // ["world"]
db.push("b", {test: "erenaydb"}) // [{test: "erenaydb"}]
db.push("b", {test2: "erenaydb2"}) // [{test: "erenaydb"}, {test2: "erenaydb2"}]
db.delByPriority("b", 1) // [{test2: "erenaydb"}]
db.setByPriority("b", {newtest:"hey this is edited"}, 1) // [{newtest:"hey this is edited"}]
db.has("x") // true
db.delete("x") // true
db.deleteAll() // trueIf you've any question, you can join to my Discord server: Click me!