jarjs

0.0.5 • Public • Published

Jarjs Logo

Jarjs

A minimalistic Javascript in-memory database

Status

Warning! JarJS is under development! the API is not yet finished! use this as preview only, not for production puprpose.

Roadmap

  • Persistance
  • Standalone server
  • Key-Value capabilities

Install

npm install jarjs

Quick start

var Jar = require('jarjs');
var db = new Jar({name : 'myDatabase'});
 
/* OPERATIONS ON DOCUMENTS */
 
//Creates a new collection
db.createCollection('users');
 
//Adds a document to the collection
db
.collection('users')
.insert({
     name : 'John',
     email : 'john@mail.com',
     data : {
       skills : ['javascript','nodejs'],
       salary : 3000
     }
});
//Updates a document
db.collection('users').update({email : 'john@mail.com'},{data : {salary : 4000}})
 
//Query the database
db.collection('users').findOne({email : 'john@mail.com'});
 
/* OPERATION ON VALUES */
 
//Creates a new key value pair
db.set('myKey','myValue');
 
//Returns 'myValue'
db.get('myKey');
 
//Returns undefined
db.get('wrongKey');
 
//Deletes the myKey pair
db.unset('myKey');
 
/* OPERATIONS ON LISTS */
 
//Creates an empty list with 'myList' key
db.list('myList');
 
//pushes an element on the left of the list
db.lpush('myList','LEFT');
 
//pushes an element on the right of the list
db.rpush('myLyst','RIGHT');
 
//deletes every key
db.flushall();
 

Package Sidebar

Install

npm i jarjs

Weekly Downloads

5

Version

0.0.5

License

GPLv2

Last publish

Collaborators

  • fatmatto