Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyMongo and toArray() method

I need to make some benchmarks on a small database (64MB) and I need to figure out what is the smartest way to fetch whole Mongo collection into python object with PyMongo? In JavaScript, there is toArray() method but I cannot find anything similar in python. Thanks in advance!

like image 740
k_wisniewski Avatar asked Jan 04 '12 07:01

k_wisniewski


1 Answers

Have you tried?

result = list(db.collection.find())
like image 81
Nat Avatar answered Sep 28 '22 20:09

Nat