pub struct CounterBuilder {
pub collection: String,
pub name: String,
pub increment: i64,
}Expand description
Builder for MongoDB counter operations.
Fields§
§collection: StringCollection name for counters.
name: StringCounter name.
increment: i64Increment amount.
Implementations§
Source§impl CounterBuilder
impl CounterBuilder
Sourcepub fn collection(self, collection: impl Into<String>) -> Self
pub fn collection(self, collection: impl Into<String>) -> Self
Set the collection name for counters.
Sourcepub fn next_value_command(&self) -> Value
pub fn next_value_command(&self) -> Value
Get the findAndModify command document for getting the next value.
Returns a JSON-like structure that can be used with MongoDB driver.
Sourcepub fn increment_pipeline(&self) -> Vec<Value>
pub fn increment_pipeline(&self) -> Vec<Value>
Get the aggregation pipeline stage for incrementing the counter.
Sourcepub fn init_document(&self, start_value: i64) -> Value
pub fn init_document(&self, start_value: i64) -> Value
Get the document for initializing a counter.
Sourcepub fn reset_document(&self, value: i64) -> Value
pub fn reset_document(&self, value: i64) -> Value
Get the update document for resetting a counter.
Trait Implementations§
Source§impl Clone for CounterBuilder
impl Clone for CounterBuilder
Source§fn clone(&self) -> CounterBuilder
fn clone(&self) -> CounterBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CounterBuilder
impl RefUnwindSafe for CounterBuilder
impl Send for CounterBuilder
impl Sync for CounterBuilder
impl Unpin for CounterBuilder
impl UnwindSafe for CounterBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more