title: Fast method for PyMongo Cursor to array/DataFrame
body: <p>I am fetching 43k records with just 2 datetime fields from my mongoDB server. It takes me around 10 seconds to 20 seconds to convert the cursor to array to dataframe. I have tried variety of ways to do this:</p>
  
  <p>Attempt-1</p>
  
  <pre><code>docs=pd.DataFrame(list(collection.find({"dId":4},{"ts":1,"cd":1,"_id":0}).sort("ts",-1).limit(43200)))
  </code></pre>
  
  <p>Attempt-2</p>
  
  <pre><code>docs=collection.find({"dId":4},{"ts":1,"cd":1,"_id":0}).sort("ts",-1).limit(43200)
  ts = np.empty([2,43200], dtype='datetime64[us]')
  for i, doc in enumerate(docs):
      ts[0][i] = doc["ts"]
      ts[1][i] = doc["cd"]
  df = pd.DataFrame()
  df['ts']=ts[0]
  df['cd']=ts[1]
  </code></pre>
  
  <p>Attempt-3</p>
  
  <pre><code>docs=collection.find({"dId":4},{"ts":1,"cd":1,"_id":0}).sort("ts",-1).limit(43200)
  arr= [x for x in docs]
  </code></pre>
  
  <p>Attempt-4</p>
  
  <pre><code>my_data = list(map(lambda x: list(x.values()), collection.find({"dId":4},{"ts":1,"cd":1,"_id":0}).sort("ts",-1).limit(43200)))
  result=np.array(my_data)
  </code></pre>
  
  <p>How to reduce this time to less than 2 seconds?</p>