我如何gridfs
与不接受非阻塞 gridfs 并且只接受非阻塞其他调用的库一起使用?我得到了错误:
from mongotor.database import Database
import gridfs
db = Database.connect("localhost:27017", "mydb")
fs = gridfs.GridFS(db)
---------------------------------------------------------------------------
TypeError
Traceback (most recent call last)
<ipython-input-4-e0f456d7d574> in <module>()
----> 1 fs = gridfs.GridFS(db)
C:\Python27\lib\site-packages\pymongo-2.3_-py2.7-win-amd64.egg\gridfs\__init__.pyc in __init__(self, database, collection)
49 """
50 if not isinstance(database, Database):
---> 51 raise TypeError("database must be an instance of Database")
52
53 self.__database = database
TypeError: database must be an instance of Database
我是否了解 gridfs必须仅 使用BLOCKING数据库?(pymongo)
那么,我是否使用 pymongo 和 mongotor,然后我得到了:
from mongotor.database import Database
from pymongo import Connection
import gridfs
db = Database.connect("localhost:27017", "mydb")
dbb = Connection().mydb
fs = gridfs.GridFS(dbb)
那么dbb
只有在有图片要提供的时候才会使用?它当然会阻止数据库调用?所以如果有人请求图片,那么我的非阻塞呼叫会阻塞吗?