Search:

Search all manuals
Search this manual
Manual
Couchbase Server Manual 2.0
Community Wiki and Resources
Download Couchbase Server 2.0
Couchbase Developer Guide 2.0
Client Libraries
Couchbase Server Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
Couchbase Server Manual 2.0
Child Sections
Chapters

Chapter 9. Views and Indexes

Table of Contents

9.1. View Basics
9.2. View Operation
9.2.1. How Expiration Impacts Views
9.2.2. How Views Function in a Cluster
9.2.3. View Performance
9.2.4. Index Updates and the stale Parameter
9.2.5. Automated Index Updates
9.3. Views and Stored Data
9.3.1. JSON Basics
9.3.2. Document Metadata
9.3.3. Non-JSON Data
9.3.4. Document Storage and Indexing Sequence
9.4. Development and Production Views
9.5. Writing Views
9.5.1. Map Functions
9.5.2. Reduce Functions
9.5.3. Views on non-JSON Data
9.5.4. Built-in Utility Functions
9.5.5. View Writing Best Practice
9.6. Views in a Schema-less Database
9.7. Design Document REST API
9.7.1. Storing a Design Document
9.7.2. Retrieving a Design Document
9.7.3. Deleting a Design Document
9.8. Querying Views
9.8.1. Querying Using the REST API
9.8.2. Selecting Information
9.8.3. Pagination
9.8.4. Grouping in Queries
9.8.5. Ordering
9.8.6. Understanding Letter Ordering in Views
9.8.7. Error Control
9.9. View and Query Pattern Samples
9.9.1. General Advice
9.9.2. Validating Document Type
9.9.3. Document ID (Primary) Index
9.9.4. Secondary Index
9.9.5. Using Expiration Metadata
9.9.6. Emitting Multiple Rows
9.9.7. Date and Time Selection
9.9.8. Selective Record Output
9.9.9. Sorting on Reduce Values
9.9.10. Solutions for Simulating Joins
9.9.11. Simulating Transactions
9.9.12. Simulating Multi-phase Transactions
9.10. Translating SQL to Map/Reduce
9.10.1. Translating SQL Field Selection (SELECT) to Map/Reduce
9.10.2. Translating SQL WHERE to Map/Reduce
9.10.3. Translating SQL ORDER BY to Map/Reduce
9.10.4. Translating SQL GROUP BY to Map/Reduce
9.10.5. Translating SQL LIMIT and OFFSET
9.11. Writing Geospatial Views
9.11.1. Adding Geometry Data
9.11.2. Views and Queries

Views within Couchbase Server process the information stored in your Couchbase Server database, allowing you to index and query your data. A view creates an index on the stored information according to the format and structure defined within the view. The view consists of specific fields and information extracted from the objects stored in Couchbase. Views create indexes on your information allowing you to search and select information stored within Couchbase Server.

Note

Views are eventually consistent compared to the underlying stored documents. Documents are included in views when the document data is persisted to disk, and documents with expiry times are removed from indexes only when the expiration pager operates to remove the document from the database. Fore more information, read Section 9.2, “View Operation”.

Views can be used within Couchbase Server for a number of reasons, including:

You can create multiple views and therefore multiple indexes and routes into the information stored in your database. By exposing specific fields from the stored information, views enable you to create and query the information stored within your Couchbase Server, perform queries and selection on the information, and paginate through the view output. The View Builder provides an interface for creating your views within the Couchbase Server Web Console. Views can be accessed using a suitable client library to retrieve matching records from the Couchbase Server database.