def add_insert(self, document):
"""Add an insert document to the list of ops.
"""
if not isinstance(document, dict):
raise TypeError('document must be an instance of dict')
# Generate ObjectId client side.
if '_id' not in document:
document['_id'] = ObjectId()
self.ops.append((_INSERT, document))
评论列表
文章目录