A minimal in-memory distributed master-less document database
This is a minimal in-memory distributed master-less document database database.
minidb_cluster:join()
, or manually make a cluster passing a list of
seeds minidb_cluster:make([bootstrap_node1])
.minidb_cluster:status()
minidb_cluster:join('bootstrap_node')
minidb_cluster:leave()
minidb:ping()
minidb:put(key, value)
minidb:patch(key, {subkey1, subvalue1})
minidb:get(key)
or minidb:get(key, default)
minidb:find([..])
minidb:keys()
minidb:delete
minidb:drop()
The query language is similar to the one used by mongodb:
minidb:find([{"section", {'$eq', "books"}}, {"likes", {'$gt', 100}])
Operators available:
Op. | Name | Example |
---|---|---|
'$eq' |
Equals | {"section", {'$eq', "books"}} |
'$ne' |
Not Equals | {"section", {'$ne', "books"}} |
'$gt' |
Greater Than | {"likes", {'$gt', 100}} |
'$gte' |
Greater or Equals | {"likes", {'$gte', 100}} |
'$lt' |
Lower Than | {"likes", {'$lt', 100}} |
'$lte' |
Lower or Equals | {"likes", {'$lte', 100}} |
Note: to get everything: minidb:find([])
.
$ rebar3 compile
Start the first node:
$ make node1
Start the second node:
$ make node2
After 5 seconds, the second node will automatically connect to the first in a cluster.
To clean all the configuration (cluster informations):
$ make clean