moon.database
v1.0.1
Published
A simple and fast key-value database for Node.js
Maintainers
Readme
⭐ Easy Database Creation
First, we create a database (optional) folder and create a file called database.json (optional) and write the following code.
{}Secondly we define the file path.
const { JsonDatabase } = require("moon.db");
const db = new JsonDatabase({ databasePath: "./database/database.json" });🙂↕️ Example Usage
db.set("key", "value"); // sets the key to value
db.get("key"); // returns value
db.has("key"); // returns true
db.delete("key"); // deletes the key
db.push("array", "value"); // pushes value to the array
db.unpush("array", "value"); // removes value from the array
db.add("number", 5); // adds 5 to the number
db.subtract("number", 5); // subtracts 5 from the number