/// Execute a count query on the underlying collection.
/// The `query` bson is not validated, simply passed along to the server. As such, compatibility and errors should be validated in the appropriate server documentation.
///
/// For more information, see the [query reference](https://docs.mongodb.org/manual/reference/operator/query/) at the MongoDB website.
pubfncount(
&self,
query: &Document,
@ -294,6 +334,9 @@ impl<'a> Collection<'a> {
}
}
/// Create a bulk operation. After creating call various functions such as `update`,
/// `insert` and others. When calling `execute` these operations will be executed in
/// batches.
pubfncreate_bulk_operation(
&'aself,
options: Option<&BulkOperationOptions>
@ -314,6 +357,7 @@ impl<'a> Collection<'a> {
BulkOperation::new(self,inner)
}
/// Request that a collection be dropped, including all indexes associated with the collection.
pubfndrop(&mutself)-> Result<()>{
assert!(!self.inner.is_null());
letmuterror=BsoncError::empty();
@ -330,6 +374,10 @@ impl<'a> Collection<'a> {
Ok(())
}
/// Execute a query on the underlying collection.
/// If no options are necessary, query can simply contain a query such as `{a:1}`.
/// If you would like to specify options such as a sort order, the query must be placed inside of `{"$query": {}}`
/// as specified by the server documentation. See the example below for how to properly specify additional options to query.
pubfnfind(
&'aself,
query: &Document,
@ -371,10 +419,9 @@ impl<'a> Collection<'a> {
))
}
// Update and return an object.
//
// This is a thin wrapper around the findAndModify command. Pass in
// an operation that either updates, upserts or removes.
/// Update and return an object.
/// This is a thin wrapper around the findAndModify command. Pass in
/// an operation that either updates, upserts or removes.
/// If no `_id` element is found in document, then an id will be generated locally and added to the document.
// TODO: You can retrieve a generated _id from mongoc_collection_get_last_error().
pubfninsert(
&'aself,
document: &Document,
@ -482,6 +533,9 @@ impl<'a> Collection<'a> {
}
}
/// Remove documents in the given collection that match selector.
/// The bson `selector` is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.
/// If you want to limit deletes to a single document, add the `SingleRemove` flag.
pubfnremove(
&self,
selector: &Document,
@ -510,6 +564,8 @@ impl<'a> Collection<'a> {
}
}
/// Save a document into the collection. If the document has an `_id` field it will be updated.
/// Otherwise it will be inserted.
pubfnsave(
&self,
document: &Document,
@ -537,9 +593,8 @@ impl<'a> Collection<'a> {
}
}
/// This function shall update documents in collection that match selector.