Small and fast JSON database for Node and browser.
Warning: ark.db
is requires node.js version greater than 12!
npm i ark.db
Or, if you're using yarn
yarn add ark.db
Also, if you want to use ark.db
in browser
<script src="https://unpkg.com/[email protected]/dist/LocalStorage.min.js"></script>
<script>
const db = new LocalStorage();
</script>
const { MongoDB } = require("ark.db");
const db = new MongoDB("your mongo connect url", "your schema name");
// To update or set your data;
await db.set("example", "test"); // -> test
// To get your data;
await db.get("example"); // -> test
// To delete your data;
await db.delete("example"); // -> true
// To increase your data;
await db.add("example", 2); // -> 2
// To decrase your data;
await db.subtract("example", 1); // -> 1
// To learn database has the data;
await db.has("example"); // -> true
// To push the data;
await db.push("example", "test"); // -> "test"
// To pull the data;
await db.pull("example", "test"); // -> []
// To get all data;
await db.all();
// To delete all data;
await db.clear();
// To create a collection;
await db.createCollection("collection name");
// To delete collection you've connected;
await db.dropCollection();
// To learn database's uptime;
db.uptime();
// To change your schema name;
db.updateModel("new schema name");
// To create a schema;
db.createSchema("schema name");
const { Database } = require("ark.db");
const db = new Database();
// If you want you specify the file to save the data like; new Database("myDatas");
// To update or set your data;
db.set("example", "test"); // -> test
// To get your data;
db.get("example"); // -> test
// To delete your data;
db.delete("example"); // -> true
// To increase your data;
db.add("example", 2); // -> 2
// To decrase your data;
db.subtract("example", 1); // -> 1
// To learn database has the data;
db.has("example"); // -> true
// To push the data;
db.push("example", "test"); // -> "test"
// To pull the data;
db.pull("example", "test"); // -> []
// To get all data;
db.all();
// To delete all data;
db.clear();
// To get database's ping;
db.ping();
Thanks to Stark and hmal for his helpings.
###Â 2.7.0, 2.7.1
options
parameter while connecting to MongoDB.MongoDB
adapter.LocalStorage
adapter.pretty
and write
properties to some methods.relative path
feature.