9 mongodb & {mongolite}

MongoDB is a cross-platform and open-source document-oriented database, a kind of NoSQL database. As a NoSQL database, MongoDB shuns the relational database’s table-based structure to adapt JSON-like documents that have dynamic schemas which it calls BSON. This makes data integration for certain types of applications faster and easier. MongoDB is built for scalability, high availability and performance from a single server deployment to large and complex multi-site infrastructures.
MongoDB was first developed by MongoDB Inc., known then as 10gen, in October 2007 originally as a major part in a PaaS (Platform as a Service) product similar to Windows Azure and Google App Engine. The development was shifted to open source in 2009. MongoDB became one of the most popular NoSQL databases, being used as the backend for many major websites including eBay, Craigslist, SourceForge and The New York Times. MongoDB is available under the GNU Affero General Public License while its language drivers are available under the Apache License. There are also commercial licenses being offered. MongoDB features: Ad hoc queries - supports search by field, regular expression searches, and range queries. Indexing - any field in the BSON document can be indexed. Replication - provides high availability via replica sets which consists of two or more copies of the original data. Load balancing - sharding is the method used to allow MongoDB to scale horizontally, meaning that data will be distributed and split into ranges and then stored in different shards which can be located in different servers. Shard keys are used to determine how the data will be distributed. Aggregation - MapReduce can be applied to enable batch processing of data as well as perform aggregation operations. File storage - MongoDB can be used as file system which makes use of the above functions and acting in a distributed manner through sharding.

From: https://www.techopedia.com/definition/30340/mongodb

docker pull mongo:3.4
docker run -p 27017:27017 -d --name mongo --net r-db mongo:3.4

Try in RStudio:

library(mongolite)
a <- mongo(collection = "collection", db = "db", url = "mongodb://mongo:27017")
a$insert(iris)
a$insert(ggplot2::diamonds)
a$count()
a$find('{"cut" : "Premium", "price" : { "$lt" : 1000 } }')