Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

dusansimic/yoctodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YoctoDB - very small document based database

Very much like MongoDB

Core

The core of this module is a simple library that offers a set of functions to store objects (documents) into a simple database. Those objects can be inserted, queried, updated and deleted. The idea is to make this module as small as possible so it would be easy to run it on very small projects or Node.js apps.

Contributing

If you would like to contribute you can send pull requests. The request should containt information about your changes and how they are going to make module work better.

Installation

npm install --save yoctodb

Or

yarn add yoctodb

Usage

Require YoctoDB into your app and make a db

const YoctoDB = require('yoctodb');
const db = new YoctoDB();

Insert some data

db.insert({foo: 'bar'}).then(docs => {
	console.log('This was inserted!');
	console.log(docs);
}).catch(err => {
	console.error('Could not insert data!');
});

Find that data

db.find({foo: 'bar'}).then(docs => {
	console.log('This was found!');
	console.log(docs);
}).catch(err => {
	console.error('Nothing was found!');
});

Or find all data

db.find({}).then(docs => {
	console.log('This was found!');
	console.log(docs);
}).catch(err => {
	console.error('Nothing was found!');
});

Update that data

db.update({foo: 'bar'}, {foo: 'buzz'}).then(docs => {
	console.log('This was updated!');
	console.log(docs);
}).catch(err => {
	console.error('Nothing was updated!');
});

Delete that data

db.delete({foo: 'bar'}).then(docs => {
	console.log('Heres whats left!');
	console.log(docs);
}).catch(err => {
	console.error('Nothing was deleted!');
});

About

Simple document based database.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published