PyMongo和toArray()方法 [英] PyMongo and toArray() method

查看:109
本文介绍了PyMongo和toArray()方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在一个小型数据库(64MB)上进行一些基准测试,并且需要弄清楚用PyMongo将整个Mongo集合提取到python对象中的最聪明方法是什么?在JavaScript中,有toArray()方法,但是我在python中找不到任何类似的东西.预先感谢!

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!

推荐答案

您尝试过吗?

result = list(db.collection.find())

这篇关于PyMongo和toArray()方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆