title: Load data from MongoDB into R
body: <p>I am trying to query my <code>MongoDB</code> database from <code>R</code>.
  I think I lost part of it in the process.
  Does <code>R</code> have any limit, and how can I ensure all my records are loaded into <code>R</code>?</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code># inspect number of record in mongodb
  db.complaints.count()
  &gt;395 853
  
  # write a query to load data into R
  library(dplyr)
  complaints = data.frame(stringsAsFactors = FALSE)
  db = "customers.complaints"
  cursor = mongo.find(mongo, db)
  
  i = 1
  while (mongo.cursor.next(cursor))
  {
      tmp = mongo.bson.to.list(mongo.cursor.value(cursor))
      tmp.df = as.data.frame(t(unlist(tmp)), stringsAsFactors=F)
      complaints = rbind.fill(complaints, tmp.df)
  }
  </code></pre>
  
  <p>I get <code>[1] 47077    15</code> after checking the loading in <code>R</code> with <code>dim(complaints)</code>.</p>
  
  <p>How can make sure I get all my collections in <code>R</code>?</p>