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>
- Fast
- Lightweight
- Easy to use
- Simple
- Beginner friendly
- Dot notation
- Relative path support
- Browser support
- MongoDB support
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
- Some fixes.
- Fixed a bug.
- TypeScript rewrite.
- Fixed a bug.
- Fixed some bugs.
- Added
options
parameter while connecting to MongoDB.
- Added
MongoDB
adapter. - Added MongoDB support.
- Added
LocalStorage
adapter. - Added browser support.
- Added
pretty
andwrite
properties to some methods. - Added
relative path
feature.
- Fixed multiple bugs.
- Fixed a bug.
- Added pull method.
- Get and set methods are accelerated.
- Large-scale optimizations have been made.
- All methods are synchronous.
- A little accelerated.
- Fixed some bugs.
- All methods are asynchronous.