Page History: rmongodb - R Driver for MongoDB
Compare Page Revisions
Page Revision: 2011/09/06 03:24
rmongodb, a client driver for the
R language to
MongoDB, was developed with help from
10Gen, Inc.The full reference manual is available here:
rmongodb.pdfThe source code for this driver is now publicly available at
GitHub here:
https://github.com/gerald-lindsly/rmongodb.
Please contact me at
gerald@cnub.org if you have comments, issues or bug reports concerning the driver.
Plans are to submit the driver to the
Comprehensive R Archive Network (CRAN) for pre-built distribution soon.
Wish List
Under consideration is adding to the append functions support for the
dims attribute. Currently the only ways to handle multidimensional arrays is either with
mongo.bson.buffer.append.object()
or by user code that sets
dims itself. What I want to do with this wish is output prettier BSON that is not encumbered by the R_OBJ wrapper (nor a call to
...append.object()
). A two dimensional array would look like this, for example:
{
idmat3D : [
[ 1, 0, 0 ],
[ 0, 1, 0 ],
[ 0, 0, 1 ]
]
}
In conjunction with this,
mongo.bson.value()
,
mongo.bson.iterator.value()
, and
mongo.bson.to.list()
would have code added to them to do look ahead parsing of the input BSON to see if an element looks like a multidimensional array. All components would have to be of the same atomic type and all rows (or depth's, etc.) would have to be of the same length.
Let me know via email if you would like to see this wish implemented.
News
2011-09-05: I added
mongo.bson.buffer.append.object()
last night. This allows higher level R objects to be stored in the database without loss of attributes (such as their class). The other 'append' functions lose most attributes as they are primarily targeted towards storing single values (or vectors of them). These do support the 'names' attribute as this fitted in naturally with
BSON.
mongo.bson.buffer.append.object()
puts a wrapper around an object's lower level value which can be detected by
mongo.bson.value()
,
mongo.bson.iterator.value
and
mongo.bson.to.list()
. See the docs for more information:
rmongodb.pdf.