Docs HomeMongoDB Manual

Bulk Operation Methods批量操作方法

Note

For details on a specific method, including syntax and examples, click on the link to the method's reference page.有关特定方法的详细信息,包括语法和示例,请单击该方法参考页的链接。

Tip

Starting in version 3.2, MongoDB also provides the db.collection.bulkWrite() method for performing bulk write operations.从3.2版本开始,MongoDB还提供了db.collection.bulkWrite()方法来执行批量写入操作。

Name名称Description描述
db.collection.initializeOrderedBulkOp()Initializes a Bulk() operations builder for an ordered list of operations.为有序的操作列表初始化Bulk()操作生成器。
db.collection.initializeUnorderedBulkOp()Initializes a Bulk() operations builder for an unordered list of operations.为无序的操作列表初始化Bulk()操作生成器。
Bulk()Bulk operations builder.批量操作生成器。
Bulk.execute()Executes a list of operations in bulk.批量执行操作列表。
Bulk.find()Specifies the query condition for an update or a remove operation.指定更新或删除操作的查询条件。
Bulk.find.arrayFilters()Specifies the filters that determine which elements of an array to update for an update or updateOne operation.指定筛选器,用于确定要为updateupdateOne操作更新数组中的哪些元素。
Bulk.find.collation()Specifies the collation for the query condition.指定查询条件的排序规则
Bulk.find.delete()Adds a multiple document delete operation to a list of operations.将多文档删除操作添加到操作列表中。
Bulk.find.deleteOne()Adds a single document delete operation to a list of operations.将单个文档删除操作添加到操作列表中。
Bulk.find.hint()Specifies the index to use for the update/replace operation.指定用于更新/替换操作的索引。
Bulk.find.remove()An alias for Bulk.find.delete().Bulk.find.delete()的别名。
Bulk.find.removeOne()An alias for Bulk.find.deleteOne().Bulk.find.deleteOne()的别名。
Bulk.find.replaceOne()Adds a single document replacement operation to a list of operations.将单个文档替换操作添加到操作列表中。
Bulk.find.updateOne()Adds a single document update operation to a list of operations.将单个文档更新操作添加到操作列表中。
Bulk.find.update()Adds a multi update operation to a list of operations.multi更新操作添加到操作列表中。
Bulk.find.upsert()Specifies upsert: true for an update operation.为更新操作指定upsert: true
Bulk.getOperations()Returns an array of write operations executed in the Bulk() operations object.返回在Bulk()操作对象中执行的写入操作的数组。
Bulk.insert()Adds an insert operation to a list of operations.将插入操作添加到操作列表中。
Bulk.toJSON()Returns a JSON document that contains the number of operations and batches in the Bulk() operations object.返回一个JSON文档,该文档包含Bulk()操作对象中的操作数和批处理数。
Bulk.toString()Returns the Bulk.toJSON() results as a string.以字符串形式返回Bulk.toJSON()结果。