When I run the the query
mongo.cursor.to.data.frame(cursor)
to fetch the documents in a collection to a data frame in R using rmongodb, I am getting thewarning message:
In mongo.cursor.to.data.frame(cursor) : This fails for most NoSQL data structures. I am working on a new solution
I checked some articles about rmongodb and I could find this message mentioned there too. Does this warning mean that there might be some issues in the resulting data frame?
The source code shows where the issues could arise
We can see it's using
plyr::rbind.filltorbinddata.frames. So this all comes down to what is passed intorbind.fill, namelyval.And
valis the result ofval <- mongo.bson.to.list(mongo.cursor.value(cursor)).So as long as
as.data.frame(val, ...)can handle the list structure you pass into it you're ok.However, it's quite easy to conceive a NoSQL data structure that will fail this:
It's at this point I should mention the
mongolitepackage, which is generally faster, but again returns adata.frame.And there's also my extension to mongolite,
mongolitedt(not yet on CRAN) that is quicker still and retrieving data, but again is limited by the result has to be coerced into adata.table