Skip to content

struct

Mongo

pub struct Mongo {
    /* private fields */
}

The browser side: builds commands for your API route.

Methods

new

pub fn new(endpoint: &str) -> Mongo

A client for the app's own MongoDB route at endpoint, which checks each request against its policy.

find

pub fn find(&self, collection: &str, filter: Json) -> Builder

Find the documents in collection matching filter.

find_one

pub fn find_one(&self, collection: &str, filter: Json) -> Builder

Find one document in collection matching filter.

count

pub fn count(&self, collection: &str, filter: Json) -> Builder

Count the documents in collection matching filter.

aggregate

pub fn aggregate(&self, collection: &str, pipeline: Json) -> Builder

Run aggregation pipeline on collection.

insert_one

pub fn insert_one(&self, collection: &str, document: Json) -> Builder

Insert document into collection.

update_one

pub fn update_one(&self, collection: &str, filter: Json, update: Json) -> Builder

Apply update to the first document in collection matching filter.

delete_one

pub fn delete_one(&self, collection: &str, filter: Json) -> Builder

Delete the first document in collection matching filter.

Trait implementations