pymongo:MongoClient或连接 [英] pymongo: MongoClient or Connection

查看:534
本文介绍了pymongo:MongoClient或连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用pymongo连接mongodb.我看到两个类可以连接到mongodb.

I am trying to connect mongodb using pymongo. I see two classes to connect to mongodb.

MongoClient and Connection. 

这两个类有什么区别?

推荐答案

MongoClient是连接到mongo实例的首选方法. Connection类已弃用.但是,就使用而言,它们非常相似.

MongoClient is the preferred method of connecting to a mongo instance. The Connection class is deprecated. But, in terms of use they are very similar.

这篇关于pymongo:MongoClient或连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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