pub trait CollectionMapReduce: ViewSchemawhere
    <Self::View as View>::Collection: SerializedCollection,{
    // Required method
    fn map<'doc>(
        &self,
        document: CollectionDocument<<Self::View as View>::Collection>
    ) -> ViewMapResult<'doc, Self>
       where CollectionDocument<<Self::View as View>::Collection>: 'doc;

    // Provided method
    fn reduce(
        &self,
        mappings: &[ViewMappedValue<'_, Self>],
        rereduce: bool
    ) -> ReduceResult<Self::View> { ... }
}
Expand description

A MapReduce implementation that automatically serializes/deserializes using CollectionDocument and SerializedCollection.

Implementing this trait automatically implements ViewSchema for the same type.

Required Methods§

source

fn map<'doc>( &self, document: CollectionDocument<<Self::View as View>::Collection> ) -> ViewMapResult<'doc, Self>where CollectionDocument<<Self::View as View>::Collection>: 'doc,

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§

source

fn reduce( &self, mappings: &[ViewMappedValue<'_, Self>], rereduce: bool ) -> ReduceResult<Self::View>

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

Implementors§