dbGetQueryForKeys-methods: Performing a MongoDB query and only return back certain keys

Description Usage Arguments See Also Examples

Description

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.

Usage

1
  dbGetQueryForKeys(rmongo.object, collection, query, keys, skip=0, limit=1000) 

Arguments

rmongo.object

The RMongo object.

collection

The name of the collection the query is being performed upon.

query

A JSON string query. See http://www.mongodb.org/display/DOCS/Advanced+Queries for more information on the MongoDB query language.

keys

A JSON string query. See http://www.mongodb.org/display/DOCS/Advanced+Queries for more information on the MongoDB query language.

skip

Offset the resultset. Can be used with limit to perform pagination.

limit

Limits the resultset size.

See Also

mongoDbConnect

Examples

1
2
3
4
  mongo <- mongoDbConnect("test")
  output <- dbInsertDocument(mongo, "test_data", '{"foo": "bar"}')  
  output <- dbGetQueryForKeys(mongo, 'test_data', '{"foo": "bar"}', '{"foo":1}')
  print(output)

RMongo documentation built on May 30, 2017, 2:31 a.m.