0

I have 200GB of data in my mongo database. I have connected it to R using rmongodb.Now I want to put 1000 random records from the database into a dataframe for analyzing. How do I do that?

I want to query in R, not in MongoDb. Also, I dont want a single record, but a 1000 records.

stkusr1234
  • 61
  • 7
  • 1
    Also check this post: http://stackoverflow.com/questions/2824157/random-record-from-mongodb – Martin Schmelzer Oct 08 '15 at 10:10
  • 1
    It might be worth noting here that the next release ( and current development branch ) of MongoDB has a `$sample` aggregation pipeline stage that does exactly this, without the required testing of other current solutions and also allows for other stages to manipulate and/or filter the data before that "sample" is taken. Food for thought. – Blakes Seven Oct 08 '15 at 10:14
  • The post that is mentioned works on MongoDb. But I want to query in R – stkusr1234 Oct 08 '15 at 10:39
  • @stkusr1234: then why do you tag it with [tag:mongodb]? – Willem Van Onsem Oct 08 '15 at 11:14
  • That is because my data is in monogodb. – stkusr1234 Oct 09 '15 at 06:13

0 Answers0