Rmongodb is very slow to create data.frame

I am using MongoDB to track parsing data in R. I originally used MySQL which worked fine, but I wanted to test MongoDB for this purpose. The dataset contains about 200 million records so far. Using RODBC I can quickly get the query result in data.frame usingsqlQuery(conn, "select * from td where prd = 'TY' and date = '2012-01-03'")

In MongoDB, I have documents like Document{{_id=5537ca647a3ad42a84374f0a, prd=TY, time=1325661600043, px=130.6875, sz=11}}

In Java, I can get data on the number of ticks per day - about 100,000 entries, create Tick objects and add them to an array, in just 2 seconds.

Using rmongodb takes the bottom value forever. Any ideas how to improve this?

query <- mongo.bson.from.list( list(product = "TY", date = as.POSIXct("2012-01-04")) )
res.cursor <- mongo.find(mongo, db.coll, query, limit = 100e3, options=mongo.find.exhaust)
resdf <- mongo.cursor.to.data.frame(res.cursor)

      

Use is find.all

evenly slow.

+3


source to share





All Articles