Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (33 sloc) 1.43 KB
\title{Performing a MongoDB query}
Send a json query to mongodb.
The output is a data.frame object and will work properly only if the mongoDB collection contains primitive data types. It may not work properly if there are any embedded documents or arrays.
dbGetQuery(rmongo.object, collection, query, skip=0, limit=1000)
\item{rmongo.object}{The RMongo object.}
\item{collection}{The name of the collection the query is being performed upon.}
\item{query}{A JSON string query. See for more information on the MongoDB query language.}
\item{skip}{Offset the resultset. Can be used with limit to perform pagination.}
\item{limit}{Limits the resultset size.}
mongo <- mongoDbConnect("test")
output <- dbInsertDocument(mongo, "test_data", '{"foo": "bar"}')
output <- dbGetQuery(mongo, 'test_data', '{"foo": "bar"}')
output <- dbInsertDocument(mongo, "test_data", '{"foo": "bar with spaces"}')
output <- dbGetQuery(mongo, 'test_data', '{"foo": { "$regex": "bar*", "$options": "i"} }')