问题描述
该笔记将记录:在 Python 中,如何操作常见数据库;
MongoDB
该部分将介绍访问 MongoDB 数据库的方法。在示例中,我们使用 PyMongo 模块:
我们使用 PyMongo 客户端,安装:
#!/bin/sh pip3 install pymongo
访问项目仓库:http://github.com/mongodb/mongo-python-driver
访问官方文档:https://api.mongodb.com/python/current/api/index.html
我们主要使用 pymongo 文档:https://api.mongodb.com/python/current/api/pymongo/index.html
最常使用 MongoClient 对象:https://api.mongodb.com/python/current/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient
下面只进行简短地介绍,更多内容请参考官方文档;