Struct mongo_driver::collection::BulkOperation
[−]
[src]
pub struct BulkOperation<'a> { /* fields omitted */ }
Provides an abstraction for submitting multiple write operations as a single batch.
Create a BulkOperation
by calling create_bulk_operation
on a Collection
. After adding all of
the write operations using the functions on this struct, execute
to execute the operation on
the server in batches. After executing the bulk operation is consumed and cannot be used anymore.
Methods
impl<'a> BulkOperation<'a>
[src]
pub fn insert(&self, document: &Document) -> Result<()>
[src]
Queue an insert of a single document into a bulk operation.
The insert is not performed until execute
is called.
pub fn remove(&self, selector: &Document) -> Result<()>
[src]
Queue removal of all documents matching the provided selector into a bulk operation.
The removal is not performed until execute
is called.
pub fn remove_one(&self, selector: &Document) -> Result<()>
[src]
Queue removal of a single document into a bulk operation.
The removal is not performed until execute
is called.
pub fn replace_one(
&self,
selector: &Document,
document: &Document,
upsert: bool
) -> Result<()>
[src]
&self,
selector: &Document,
document: &Document,
upsert: bool
) -> Result<()>
Queue replacement of a single document into a bulk operation.
The replacement is not performed until execute
is called.
pub fn update_one(
&self,
selector: &Document,
document: &Document,
upsert: bool
) -> Result<()>
[src]
&self,
selector: &Document,
document: &Document,
upsert: bool
) -> Result<()>
Queue update of a single documents into a bulk operation.
The update is not performed until execute
is called.
TODO: document must only contain fields whose key starts with $, these is no error handling for this.
pub fn update(
&self,
selector: &Document,
document: &Document,
upsert: bool
) -> Result<()>
[src]
&self,
selector: &Document,
document: &Document,
upsert: bool
) -> Result<()>
Queue update of multiple documents into a bulk operation.
The update is not performed until execute
is called.
TODO: document must only contain fields whose key starts with $, these is no error handling for this.
pub fn execute(self) -> BulkOperationResult<Document>
[src]
This function executes all operations queued into this bulk operation. If ordered was set true, forward progress will be stopped upon the first error.
This function takes ownership because it is not possible to execute a bulk operation multiple times.
Returns a document with an overview of the bulk operation if successfull.