def wrap(self, obj):
if obj.__class__ is Collection:
# Replace pymongo.collection.Collection with MotorCollection
return self.database[obj.name]
elif obj.__class__ is Cursor:
return MotorCursor(obj, self)
elif obj.__class__ is CommandCursor:
return MotorCommandCursor(obj, self)
else:
return obj
评论列表
文章目录