MapReduce Views Using the C SDK with Couchbase Server
You can use MapReduce views to create queryable indexes in Couchbase Data Platform.
|Views is deprecated in Couchbase Server 7.0, and will eventually move to unsupported status. Use our Query Service if you are starting a fresh application, or see our discussion document on the best service for you to use. We will maintain support for Views in the SDKs for so long as it can be used with a supported version of Couchbase Server.|
MapReduce queries can be further customized during query time to allow only a subset (or range) of the data to be returned.
|See the Incremental MapReduce Views and Querying Data with Views sections of the general documentation to learn more about views and their architecture.|
You can find further information in the API docs.
View operations are accessible via
Once you have a reference to the bucket you need to at least supply the name of the design document and the name of the view:
lcb_CMDVIEW *vq; std::string dName = "beer"; std::string vName = "by_location"; std::string options = "reduce=false"; lcb_cmdview_create(&vq); lcb_cmdview_callback(vq, viewCallback); lcb_cmdview_design_document(vq, dName.c_str(), dName.size()); lcb_cmdview_view_name(vq, vName.c_str(), vName.size()); lcb_cmdview_option_string(vq, options.c_str(), options.size()); lcb_cmdview_include_docs(vq, true);