0.2.4 • Published 7 years ago

hedgehogdb v0.2.4

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

hedgehogdb

Build Status

in progress!

Install

npm install hedgehogdb -g

CLI

hedgehogdb

Starts hedgehogdb & milton pub/sub server listening on port 8000

hedgehogdb -l 9999

Starts hedgehogdb & milton pub/sub server listening on port 9999

Client Library

Append JSON documents to a collection

var client = require('hedgehogdb/client')();

var event = {
	data: 'hello world!!!'
};

client.append('hello_world_collection', event);

Appending to a non-existant collection will create it. All documents are ordered by automatically ordered by insert time.

Get all documents from a collection

var client = require('hedgehogdb/client')();

client.get('hello_world_collection', function (row) {
	console.log(row); // will fire for each row in the collection
	if (row.end) { console.log('retrieved all items'); }
});

Get a list of collections

var client = require('hedgehogdb/client')();

client.collections(function (data) {
	console.log(data.collections);
	// [ 'hello_world_collection' ]
});

Live subscription to a collection via milton pub/sub

var milton = require('milton/client');

// host and port of the hedgehogdb server...
//
client = milton({ host: '192.168.0.100', port: 8000 });

client.on('hedgehog:some_collection', function (row) {
	console.log('[some_collection] new row added ', row);
})

// as a pull stream source

var pull   = require('pull-stream');
var source = require('milton/pull/source')({ host: '192.168.0.100', port: 8000 });

pull(
	source('some_collection'),
	pull.log()
)
0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago