Need help with rmongodb and date field filter criteria

bigdata
mongodb

#1

I need to retrieve data for last 2 years into R from mongodb.
So, I was trying the below code snippet but getting error in the call to mongo.find…can someone help?

the date field stored in the below format
"created" : ISODate(“2004-09-21T20:51:41.000Z”)

In R, my code is

# filter the dataset using query

query = mongo.bson.buffer.create()
startDate <- as.Date(“2013-01-01”)
endDate <- as.Date(“2013-08-01”)
mongo.bson.buffer.start.object(query ,“created”)
mongo.bson.buffer.append(query, “$gt”, startDate)
mongo.bson.buffer.append(query, “$lt”, endDate)
mongo.bson.buffer.finish.object(query)
query = mongo.bson.from.buffer(query)

create the cursor

cursor = mongo.find(mongo, ns = DBNS, query = query, fields = fields, skip=0)


#2

@rumsinha

Please paste the error output to understand the error better.

Thanks and Regards