Description Usage Arguments Value Methods References See Also
Comparable to mongolite::mongo, but with a few extra methods (taggedfind, adjust), an extra RMongo-object, and handles to the collection object and client object exposed, so you can write your own extensions
1 2 |
collection |
name of collection |
db |
name of database |
url |
address of the mongodb server in mongo connection string URI format |
host, port |
alternatively, you can provide a host and port, which is then resolved to "mongodb://host[:port] Ignored if url is given. Defaults to localhost:27017 |
verbose |
emit some more output |
options |
additional connection options such as SSL keys/certs. See mongolite documentation |
extraSlots |
list of extra slots/methods to attach to the object. Useful to keep track of additional properties,
see for example how it is used with |
A pointer to a collection on the server. It can be interfaced using methods, or the client or col attributes.
The same methods as mongo
provides, along with the following:
taggedfind(qry='{}', tagfields='_id', arrayfield, sort='{}', skip=0, limit=0, handler=NULL, pagesize=1000, cachesize=5e4, verbose=verbose, stringsAsFactors=default.stringsAsFactors())
Find values inside documents, with pointers to the root-document, see taggedMongofind
. Verbose defaults to the value given at creation of monPlus, but can be adjusted.
adjust(findqry='{}', infields=c('All'), setfield='extraInfo',unboxsubf=c(), FUN, FUNvectorized=FALSE, skip=0, limit=0,pagesize=1000, verbose=verbose)
Adjust values in DB with FUN, see mongoAdjust
lives(tempname=NULL)
Test if connection is still alive, and documents can be inserted, retrieved and removed. For debugging, you can apply an ID-field for a temporary inserted document, if NULL a random string is generated.
Beside these methods, you can:
Access the client and collection objects themselves. In mongolite::mongo() these were hidden attributes, here you can access them directly
Get access to the used parameters: collection (in the return called collectionname to avoid confusion with the collection-object), db (called dbname), url, host, port, verbose and options
Get access to extra slots you've specified with extraSlots, to add more properties and methods.
Get an accompanying RMongo-object, as if you called RMongo::mongoDBConnect(), so you can use for example dbShowCollections(monPlus('MyCol','MyDb')$Rmongo)
They are mostly useful if you want to dig deeper into the methods
mongo
Mongolite User Manual
Jeroen Ooms (2014). The jsonlite
Package: A Practical and Consistent Mapping Between JSON Data and R Objects. arXiv:1403.2805. http://arxiv.org/abs/1403.2805
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.