def __init__(self, database, collection="fs"):
"""
An instance of GridFS on top of a single Database.
:Parameters:
- `database`: a :class:`MotorDatabase`
- `collection` (optional): A string, name of root collection to use,
such as "fs" or "my_files"
.. mongodoc:: gridfs
.. versionchanged:: 0.2
``open`` method removed; no longer needed.
"""
if not isinstance(database, MotorDatabase):
raise TypeError("First argument to MotorGridFS must be "
"MotorDatabase, not %r" % database)
self.io_loop = database.get_io_loop()
self.collection = database[collection]
self.delegate = self.__delegate_class__(
database.delegate,
collection,
_connect=False)
评论列表
文章目录