mskdb
Version:
This is a nosql database, built with node js
103 lines (65 loc) • 2.3 kB
Markdown
# mskdb
[](https:#www.npmjs.com/package/mskdb)
[](https:#opensource.org/licenses/MIT)
## Description
This is a pure json based javascript noqsl database.
## Table of Contents
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
## Installation
To install and run the project, follow these steps:
1. Clone the repository.
npm i MSKDB
## Configuration
This is the basic configuration of the package
const MSKDB = require('MSKDB');
const db = new MSKDB({
directory: 'models', #string | default directory to save all your db files
extension: 'MSKDB', #string | the database extension
name: 'database', #string | the database name
backup: false, #beoloen true | false
backup_path: 'backup', #string | this is a path to your backup file
log: false #beoloen | log results to console
});
const userDB = new MSKDB({
name: "Users", # the database name
});
database extension
const userDB = new MSKDB({
extention: "db", # the database extension
});
database directory
const userDB = new MSKDB({
directory: "model", # default directory to save all your db files
});
database backup
const userDB = new MSKDB({
backup: false #beoloen true | false
});
when the backup is enable it will automatically save all your file once any chance is made
database backup_path
const userDB = new MSKDB({
backup_path: "./bk" # this is a path to your backup file
});
## Usage
db.info()
To use this database in your project simply follow this examples
# creating new database
db = new MSKDB("database name", "database extension")
# deleting existing database
db.format();
# inserting data into the database
db.insert({ name: "peter", age: 19, profession: "Software developer" });
# dropping a row
db.drop(5);
db.delete(1);
# updating a row
db.update(5, { name: "peter", age: 19, profession: "graphics designer" });
db.amend(5, { name: "peter", age: 19, profession: "graphics designer" });
# drop database
db.wipe();
# search data
db.find({uid: 'random text: 41'});
# clone data
db.clone('./test.bson');