[−][src]Trait avocado::ext::DocumentExt
Convenience methods for implementing transform()
methods in various
traits in the ops
module.
Required methods
fn try_remove(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key. Return an error if no such key-value pair is present in the document.
fn remove_bool(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is a bool
.
Return an error if the key is missing or the value is not a bool
.
fn remove_i32(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is an i32
.
Return an error if the key is missing or the value is not an i32
.
fn remove_i64(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is an i64
.
Return an error if the key is missing or the value is not an i64
.
fn remove_f64(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is an f64
.
Return an error if the key is missing or the value is not an f64
.
fn remove_number(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is any number. Return an error if the key is missing or the value is not numeric.
fn remove_str(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is a string. Return an error if the key is missing or the value is not a string.
fn remove_array(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is an Array
.
Return an error if the key is missing or the value is not an Array
.
fn remove_document(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is a Document
.
Return an error if the key is missing or the value is not a Document
.
fn remove_object_id(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is an ObjectId
.
Return an error if the key is missing or the value is not an ObjectId
.
fn remove_datetime(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is a DateTime
.
Return an error if the key is missing or the value is not a DateTime
.
fn remove_timestamp(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is a TimeStamp
.
Return an error if the key is missing or the value is not a TimeStamp
.
fn remove_generic_binary(&mut self, key: &str) -> Result<Bson>
Remove the value corresponding to the given key if it is a Binary
of
the Generic
subtype. Return an error if the key is missing or the
value is not a Binary
of the Generic
subtype.
fn remove_inner_doc(&mut self, key: &str) -> Result<Document>
Remove the value corresponding to the given key if it is a Document
.
Return an error if the key is missing or the value is not a Document
.
The return type of this method contains Document
instead of Bson
because it is intended for use with embedded documents.