0.22.7 • Published 7 months ago

vlodia.db v0.22.7

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

vlodia.db

A simple Json/Mongo Database module for your nodejs application.

downloads npm version

Installation

Warning: vlodia.db is requires node.js version greater than 12!

npm i vlodia.db

Or, if you're using yarn

yarn add vlodia.db

Also if you want to use vlodia.db in browser:

<script src="https://unpkg.com/vlodia.db@0.22.4/dist/LocalStorage.js"></script>
<script>
	const db = new LocalStorage();
</script>

Features

  • Fast
  • Lightweight
  • Easy to use
  • Simple
  • Beginner friendly
  • Dot notation
  • Relative path support
  • Browser support
  • MongoDB support

Usage

MongoDB Usage

const { MongoDB } = require("vlodia.db");
const db = new MongoDB("your mongo connect url", "your schema name");

// To update / 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");

JSON Database Usage

const { Database } = require("vlodia.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();

Me

Discord; Github;

Thanks

Thanks to Yaloshai for his helping!

Changelog

0.22.6

Added LocalStorage Adapter Added browser support

0.22.7

7 months ago

0.22.6

7 months ago

0.22.5

7 months ago

0.22.4

7 months ago

0.22.3

8 months ago

0.22.2

8 months ago

0.22.1

8 months ago