Learn R Programming

jsonlite (version 0.9.1)

toMongo: Export to MongoDB

Description

Exports a dataframe to a format that can be imported with the mongoimport command line tool included with MongoDB.

Usage

toMongo(x, array = FALSE, POSIXt = "mongo", raw = "mongo", ...)

Arguments

x
a dataframe
array
if output should be an array. See details.
POSIXt
passed on to toJSON
raw
passed on to toJSON
...
other arguments for toJSON

Details

By default mongoimport expects a datafile in which every line is a record in the collection. Hence the complete output is not valid JSON itself. Alternatively, if array=TRUE the output will be wrapped a JSON array. When using the latter, we need to pass --jsonArray to mongoimport.