motor介绍
motor是tornado的一个python异步操作mongodb的库,功能很强大。官方这样说
MOTOR:是一个异步操作MongoDB的python 驱动库
他提供回调和可预期的非阻塞基础api和mongodb进行通信,在tornado 或者asyncio可以很好的使用它。
他的源码地址:https://github.com/mongodb/motor
文档地址:https://motor.readthedocs.io/en/stable/
使用他的人这样说:
“We use Motor in high throughput environments, processing tens of thousands of requests per second. It allows us to take full advantage of modern hardware, ensuring we utilise the entire capacity of our purchased CPUs. This helps us be more efficient with computing power, compute spend and minimises the environmental impact of our infrastructure as a result.”
—David Mytton, Server Density
“We develop easy-to-use sensors and sensor systems with open source software to ensure every innovator, from school child to laboratory researcher, has the same opportunity to create. We integrate Motor into our software to guarantee massively scalable sensor systems for everyone.”
—Ryan Smith, inXus Interactive
英语太烂,不翻译别人的原话了,将就这看。
安装 motor
直接使用pip
$pip install motor
当然也可以下载源码自己整,源码地址在上面已经写出来了。看readme.md即可得知怎么安装。
一般是这样安装
$python setup.py install 不保证可以,一般python的安装包都用这个命令可以安装,由于我是用pip安装,这里不演示安装了。
所有的操作如果是linux 记得是超级用户哦 sudo 也可以安装,如果你在sudo列表里的话。
如何从官方获取帮助和提问题
1、通过官方提供的谷歌组来获得帮助:
https://groups.google.com/forum/?fromgroups#!forum/mongodb-user
2、验证问题或者特殊问题,请向官方提出帮助
https://jira.mongodb.org/secure/Dashboard.jspa
下面是原文连接
Contents
Differences between Motor and PyMongo
Motor Features
Installation
Requirements
Tutorial: Using Motor With Tornado
Tutorial: Using Motor With asyncio
Motor Examples
Changelog
Motor 1.0 Migration Guide
Developer Guide
Contributors
Classes
Motor Tornado API
MotorClient – Connection to MongoDB
MotorDatabase
MotorCollection
MotorCursor
Motor GridFS Classes
motor.web - Integrate Motor with the Tornado web framework
Motor asyncio API
AsyncIOMotorClient – Connection to MongoDB
AsyncIOMotorDatabase
AsyncIOMotorCollection
AsyncIOMotorCursor
asyncio GridFS Classes
motor.aiohttp - Integrate Motor with the aiohttp web framework
有需要可以看。