A newer version of this documentation is available.

View Latest

MapReduce Views

  • concept
    +
    You can use MapReduce views to create queryable indexes in Couchbase Server.
    Although still maintained and supported for legacy use, Views date from the earliest days of Couchbase Server development, and as such are rarely the best choice over, say, our Query service for your application, see our guide to choosing the right service.

    MapReduce Views

    Views are stored in design documents. The SDK provides convenient methods to create, retrieve, and remove design documents. To set up views, you create design documents that contain one or more view definitions, and then insert the design documents into a bucket.

    Creating design documents

    Each view in a design document is represented by a name and a set of MapReduce functions. The mandatory map function describes how to select and transform the data from the bucket, and the optional reduce function describes how to aggregate the results.

    Retrieving design documents

    To inspect design documents, you can either retrieve them by name or iterate through a list of documents.