[−][src]Struct mongod::query::Delete
A querier to delete documents from a MongoDB collection.
Examples
Delete all documents from a collection.
#[derive(Bson, Mongo)] #[mongo(collection="users", field, filter, update)] pub struct User { name: String, } let client = mongod::Client::new(); let deleted = mongod::query::Delete::<User>::new() .query(&client) .await .unwrap(); println!("delete {} documents", deleted);
Implementations
impl<C: Collection> Delete<C>
[src]
pub fn new() -> Self
[src]
Constructs a Delete
querier.
pub fn collation(mut self: Self, collation: Collation) -> Self
[src]
The collation to use for the operation.
Collation allows users to specify language-specific rules for string comparison, such as rules for lettercase and accent marks.
pub fn filter<F>(mut self: Self, filter: F) -> Result<Self, Error> where
C: AsFilter<F>,
F: Filter,
[src]
C: AsFilter<F>,
F: Filter,
The filter to use for the operation.
Errors
This method errors if the filter could not be converted into a BSON Document
.
pub fn hint(mut self: Self, hint: Hint) -> Self
[src]
A document or string that specifies the index to use to support the query predicate.
pub fn many(mut self: Self, many: bool) -> Self
[src]
Enable delete many for this operation.
Removes all documents that match the filter from a collection.
pub fn write_concern(mut self: Self, write_concern: WriteConcern) -> Self
[src]
The write concern for the operation.
pub async fn query(self, client: &Client) -> Result<i64, Error>
[src]
pub fn blocking(self, client: &Client) -> Result<i64, Error>
[src]
Trait Implementations
impl<C: Clone + Collection> Clone for Delete<C>
[src]
impl<C: Collection> Default for Delete<C>
[src]
Auto Trait Implementations
impl<C> RefUnwindSafe for Delete<C> where
C: RefUnwindSafe,
[src]
C: RefUnwindSafe,
impl<C> Send for Delete<C> where
C: Send,
[src]
C: Send,
impl<C> Sync for Delete<C> where
C: Sync,
[src]
C: Sync,
impl<C> Unpin for Delete<C> where
C: Unpin,
[src]
C: Unpin,
impl<C> UnwindSafe for Delete<C> where
C: UnwindSafe,
[src]
C: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,