Struct mungos::Collection

source ·
pub struct Collection<T> {
    pub db: Database,
    pub collection: Collection<T>,
}

Fields§

§db: Database§collection: Collection<T>

Implementations§

source§

impl<T> Collection<T>

source

pub async fn create_index(&self, field: &str) -> Result<CreateIndexResult>

source

pub async fn create_unique_index(&self, field: &str) -> Result<CreateIndexResult>

source

pub async fn create_index_from_doc(
    &self,
    index_doc: Document
) -> Result<CreateIndexResult>

source

pub async fn create_unique_index_from_doc(
    &self,
    index_doc: Document
) -> Result<CreateIndexResult>

source§

impl<T: DeserializeOwned + Unpin + Send + Sync> Collection<T>

source

pub async fn aggregate(
    &self,
    pipeline: impl IntoIterator<Item = impl Into<Document>>,
    options: impl Into<Option<AggregateOptions>>
) -> Result<Cursor<Document>>

source

pub async fn aggregate_collect(
    &self,
    pipeline: impl IntoIterator<Item = impl Into<Document>>,
    options: impl Into<Option<AggregateOptions>>
) -> Result<Vec<Document>>

source§

impl<T> Collection<T>

source

pub async fn bulk_upsert(
    &self,
    updates: impl Borrow<Vec<BulkUpsert>>
) -> Result<Document>

source§

impl<T: Serialize> Collection<T>

source

pub async fn create_many(
    &self,
    items: impl IntoIterator<Item = impl Borrow<T>>
) -> Result<()>

source§

impl<T: Serialize> Collection<T>

source

pub async fn create_one(&self, item: impl Borrow<T>) -> Result<String>

source§

impl<T> Collection<T>

source

pub async fn delete_many(&self, filter: Document) -> Result<DeleteResult>

source§

impl<T> Collection<T>

source

pub async fn delete_one(&self, id: &str) -> Result<String>

source§

impl<T: DeserializeOwned + Unpin + Send + Sync> Collection<T>

source

pub async fn find_one(
    &self,
    filter: impl Into<Option<Document>>,
    options: impl Into<Option<FindOneOptions>>
) -> Result<Option<T>>

source

pub async fn find_one_by_id(&self, id: &str) -> Result<Option<T>>

source§

impl<T: DeserializeOwned + Unpin + Send + Sync> Collection<T>

source

pub async fn get_many_by_id(
    &self,
    ids: &Vec<String>,
    options: impl Into<Option<FindOptions>>
) -> Result<Vec<T>>

source§

impl<T: DeserializeOwned + Unpin + Send + Sync> Collection<T>

source

pub async fn get_most_recent(
    &self,
    index: &str,
    limit: i64,
    offset: u64,
    filter: impl Into<Option<Document>>,
    projection: impl Into<Option<Document>>
) -> Result<Vec<T>>

source§

impl<T: DeserializeOwned + Unpin + Send + Sync> Collection<T>

source

pub async fn get_some(
    &self,
    filter: impl Into<Option<Document>>,
    find_options: impl Into<Option<FindOptions>>
) -> Result<Vec<T>>

source§

impl<T: DeserializeOwned + Unpin + Send + Sync> Collection<T>

source

pub async fn get_sorted_cursor(
    &self,
    filter: impl Into<Option<Document>>,
    sort_field: &str,
    sort_direction: SortDirection,
    batch_size: impl Into<Option<u32>>,
    numeric_ordering: impl Into<Option<bool>>
) -> Result<Cursor<T>>

source§

impl<T: DeserializeOwned + Unpin + Send + Sync> Collection<T>

source

pub async fn most_recent_by_cursor(
    &self,
    most_recent_by_field: &str,
    num_items: i64,
    offset: u64,
    filter: impl Into<Option<Document>>,
    projection: impl Into<Option<Document>>
) -> Result<Cursor<T>>

source§

impl<Any> Collection<Any>

source

pub async fn update_many(&self, query: Document, update: Document) -> Result<()>

source§

impl<Any> Collection<Any>

source

pub async fn update_one<T: Serialize>(
    &self,
    id: &str,
    update: Update<T>
) -> Result<()>

source§

impl<T> Collection<T>

source

pub async fn upsert(
    &self,
    query: Document,
    update: impl Into<UpdateModifications>
) -> Result<UpdateResult>

Trait Implementations§

source§

impl<T: Clone> Clone for Collection<T>

source§

fn clone(&self) -> Collection<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for Collection<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Collection<T>

§

impl<T> Send for Collection<T>where
    T: Send,

§

impl<T> Sync for Collection<T>where
    T: Sync,

§

impl<T> Unpin for Collection<T>where
    T: Unpin,

§

impl<T> !UnwindSafe for Collection<T>

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere
    T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere
    V: MultiLane<T>,

§

fn vzip(self) -> V