Struct mongo_driver::collection::Collection [] [src]

pub struct Collection<'a> { /* fields omitted */ }

Provides access to a collection for most CRUD operations, I.e. insert, update, delete, find, etc.

A collection instance can be created by calling get_collection or take_database on a Client or Database instance.

Methods

impl<'a> Collection<'a>
[src]

[src]

Execute an aggregation query on the collection. The bson 'pipeline' is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.

[src]

Execute a command on the collection. This is performed lazily and therefore requires calling next on the resulting cursor.

[src]

Simplified version of command that returns the first document immediately.

[src]

Execute a count query on the underlying collection. The query bson is not validated, simply passed along to the server. As such, compatibility and errors should be validated in the appropriate server documentation.

For more information, see the query reference at the MongoDB website.

[src]

Create a bulk operation. After creating call various functions such as update, insert and others. When calling execute these operations will be executed in batches.

[src]

Request that a collection be dropped, including all indexes associated with the collection.

[src]

Execute a query on the underlying collection. If no options are necessary, query can simply contain a query such as {a:1}. If you would like to specify options such as a sort order, the query must be placed inside of {"$query": {}} as specified by the server documentation. See the example below for how to properly specify additional options to query.

[src]

Update and return an object. This is a thin wrapper around the findAndModify command. Pass in an operation that either updates, upserts or removes.

[src]

Get the name of the collection.

[src]

Insert document into collection. If no _id element is found in document, then an id will be generated locally and added to the document.

[src]

Remove documents in the given collection that match selector. The bson selector is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation. If you want to limit deletes to a single document, add the SingleRemove flag.

[src]

Save a document into the collection. If the document has an _id field it will be updated. Otherwise it will be inserted.

[src]

This function updates documents in collection that match selector. By default, updates only a single document. Add MultiUpdate flag to update multiple documents.

Important traits for TailingCursor<'a>
[src]

Tails a query

Takes ownership of query and options because they could be modified and reused when the connections is disrupted and we need to restart the query. The query will be placed in a $query key, so the function can add configuration needed for proper tailing.

The query is executed when iterating, so this function doesn't return a result itself.

The necessary flags to configure a tailing query will be added to the configured flags if you choose to supply options.

Trait Implementations

impl<'a> Drop for Collection<'a>
[src]

[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl<'a> !Send for Collection<'a>

impl<'a> !Sync for Collection<'a>