pub trait CollectionViewSchema: Send + Sync + Debug + 'static where
    <Self::View as View>::Collection: SerializedCollection
{ type View: SerializedView; fn map(
        document: CollectionDocument<<Self::View as View>::Collection>
    ) -> ViewMapResult<Self::View>; fn unique(&self) -> bool { ... } fn lazy(&self) -> bool { ... } fn version(&self) -> u64 { ... } fn reduce(
        mappings: &[ViewMappedValue<Self::View>],
        rereduce: bool
    ) -> ReduceResult<Self::View> { ... } }
Expand description

A View for a Collection that stores Serde-compatible documents. The only difference between implmementing this and View is that the map function receives a CollectionDocument instead of a BorrowedDocument.

Required Associated Types

The view this schema is an implementation of.

Required Methods

The map function for this view. This function is responsible for emitting entries for any documents that should be contained in this View. If None is returned, the View will not include the document.

Provided Methods

If true, no two documents may emit the same key. Unique views are updated when the document is saved, allowing for this check to be done atomically. When a document is updated, all unique views will be updated, and if any of them fail, the document will not be allowed to update and an Error::UniqueKeyViolation will be returned.

Returns whether this view should be lazily updated. If true, views will be updated only when accessed. If false, views will be updated during the transaction that is updating the affected documents.

The version of the view. Changing this value will cause indexes to be rebuilt.

The reduce function for this view. If Err(Error::ReduceUnimplemented) is returned, queries that ask for a reduce operation will return an error. See CouchDB’s Reduce/Rereduce documentation for the design this implementation will be inspired by