This is an R (www.r-project.org) extension supporting access to MongoDB (www.mongodb.org) using the mongodb-c-driver (http://docs.mongodb.org/ecosystem/drivers/c/).

The latest stable version is available on CRAN: http://cran.r-project.org/package=rmongodb

Thanks to Gerald Lindsly and MongoDB, Inc. (formerly 10gen) for the initial work. In October 2013, MongoSoup (www.mongosoup.de) has overtaken the development and maintenance of the R package.

Please feel free to send us issues or pull requests via github: https://github.com/mongosoup/rmongodb

Furthermore, we are happy to get your feedback personally via email: markus@mongosoup.de


Once you have installed the package, it may be loaded from within R like any other package:


# connect to your local mongodb
mongo <- mongo.create()

# create query object 
query <- mongo.bson.from.JSON('{"age": 27}')

# Find the first 100 records
#    in collection people of database test where age == 27
cursor <- mongo.find(mongo, "test.people", query, limit=100L)
# Step though the matching records and display them
while (mongo.cursor.next(cursor))

res <- mongo.find.batch(mongo, "test.people", query, limit=100L)


There is also one demo available:


Supported Functionality by rmongodb

Good ressources to Get Started with rmongodb

Good ressources to Install and Get Started with MongoDB

Good ressources for working with JSON-Data in R:


To install the development version of rmongodb, it's easiest to use the devtools package:

# install.packages("devtools")
install_github("rmongodb", "mongosoup")

We advice using RStudio (www.rstudio.org) for the package development. The RStudio .Rproj file is included in the repository.


We use a three step version number system, e.g. v1.2.1: * first: major changes as new C libraries * second: for each new stable CRAN release * third: for each new github version ready for testing

General Development Rules