Struct mongodb::coll::Collection [] [src]

pub struct Collection {
    pub db: Database,
    pub namespace: String,
    // some fields omitted
}

Interfaces with a MongoDB collection.

Fields

A reference to the database that spawned this collection.

The namespace of this collection, formatted as db_name.coll_name.

Methods

impl Collection
[src]

Creates a collection representation with optional read and write controls.

If create is specified, the collection will be explicitly created in the database.

Returns a unique operational request id.

Extracts the collection name from the namespace. If the namespace is invalid, this method will panic.

Permanently deletes the collection from the database.

Runs an aggregation framework pipeline.

Gets the number of documents matching the filter.

Finds the distinct values for a specified field across a single collection.

Returns a list of documents within the collection that match the filter.

Returns the first document within the collection that matches the filter, or None.

Finds a single document and deletes it, returning the original.

Finds a single document and replaces it, returning either the original or replaced document.

Finds a single document and updates it, returning either the original or updated document.

Sends a batch of writes to the server at the same time.

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

Inserts the provided documents. If any documents are missing an identifier, the driver should generate them.

Deletes a single document.

Deletes multiple documents.

Replaces a single document.

Updates a single document.

Updates multiple documents.

Create a single index.

Create a single index with an IndexModel.

Create multiple indexes.

Drop an index.

Drop an index by name.

Drop an index by IndexModel.

Drop all indexes in the collection.

List all indexes in the collection.