Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fatmatto/jarjs
A minimalistic Javascript in-memory json document store
https://github.com/fatmatto/jarjs
Last synced: 1 day ago
JSON representation
A minimalistic Javascript in-memory json document store
- Host: GitHub
- URL: https://github.com/fatmatto/jarjs
- Owner: fatmatto
- License: gpl-2.0
- Created: 2015-01-08T13:07:18.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-18T17:24:29.000Z (about 10 years ago)
- Last Synced: 2025-01-05T08:48:12.970Z (22 days ago)
- Language: JavaScript
- Homepage:
- Size: 406 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Jarjs Logo](https://camo.githubusercontent.com/434818ccd1140bdb42053c8584d39e8ce81e1cf6/687474703a2f2f6935382e74696e797069632e636f6d2f323831767166612e6a7067)
# 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
```javascript
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 : '[email protected]',
data : {
skills : ['javascript','nodejs'],
salary : 3000
}
});
//Updates a document
db.collection('users').update({email : '[email protected]'},{data : {salary : 4000}})//Query the database
db.collection('users').findOne({email : '[email protected]'});/* 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();```