Which package to use to connect R with MongoDB?
mongodb, r, rmongo, rmongodb
Solution
library(rmongodb)
your connection details will likely differ from these defaults
host <- "someone.com:10200"
username <- "myuser"
password <- "mypassword"
db <- "testdatabase"
connect to mongo and then create function has the following signature
mongo <- mongo.create(host=host , db=db, username=username, password=password)
Also
> library("RMongo")
> mongo < - mongoDbConnect("db")
`RMango:` MongoDB Database interface for R. The interface is provided via Java calls to the mongo-java-driver. `rmongodb:` This R package provides an interface to the NoSQL MongoDB database using the MongoDB C-driver.
While `RMongo` package is very straight-forward and user-friendly, it did take me a while to figure out how to specify a query with `rmongodb` package
Supported Functionality by rmongodb
- Connecting and disconnecting to MongoDB Querying, inserting and
- updating to MongoDB including with JSON and BSON Creating and
- handling BSON objects Dropping collections and databases on MongoDB
- Creating indices on MongoDB collections Error handling Executing
- commands on MongoDB Adding, removing, handling files on a "Grid File
- System" (GridFS) on a MongoDB server High Level functionality as
- mongo.apply, mongo.summary, mongo.get.keys, ...
Problem
I wonder what are the main differences between `rmongodb` and `RMongo` packages for connecting `R` with MongoDB. What are the advantages and disadvantages of these two packages?