nodbi provides a single user interface for interacting with many NoSQL databases.
So far we support the following DBs:
Currently we have support for data.frame’s for the following operations
Start CouchDB on the cli or with the app
Start Elasticsearch, e.g.:
If you want to use classic Redis server, we do that through the redux package, and you’ll need to start up Redis by e.g,.
redis-server in your shell.
mongod (may need to do
iris dataset into ES
src <- src_elastic() ff <- docdb_create(src, "iris", iris) head( docdb_get(src, "iris") ) #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 5.0 3.6 1.4 0.2 setosa #> 4.9 3.1 1.5 0.1 setosa #> 4.8 3.4 1.6 0.2 setosa #> 5.4 3.9 1.3 0.4 setosa #> 5.1 3.3 1.7 0.5 setosa #> 5.2 3.4 1.4 0.2 setosa
Extension json1 is enabled in Package
RSQLite (since version 1.1). This extension is used to emulate the behaviour of MongoDB with the methods for SQLite:
collectioncorresponds to the name of a table (parameter
key) in the SQLite database
fieldsare translated into SQL commands, unless too complex.
docdb_create()are defined as follows, with exactly two columns, an index column named
_idand a column with json data named
CREATE TABLE mtcars ( _id TEXT PRIMARY_KEY NOT NULL, json JSON ); CREATE UNIQUE INDEX mtcars_index ON mtcars ( _id );
The following examples show the maximum level of complexity that can be used at this time with available json operaters (“\$eq”, “\$gt”, “\$gte”, “\$lt”, “\$lte”, “\$ne”);
query implies AND of the comma separated expressions in the absence of a prefixed logical operator (available at this time: “\$and”, “\$or”).