A newer version of this documentation is available.

View Latest

What’s New?

Couchbase Server is a comprehensive, general purpose database that supports broad set of web, mobile and IoT applications. This page lists the new features and enhancements in the 4.5.x series of Couchbase Server.

Release 4.5.1

Couchbase Server version 4.5.1 includes several N1QL improvements in the following categories:

See Release Notes 4.5.1 for information on the changes in behavior and the fixed and known issues for this release.

Higher Performance Data Access and Query

New N1QL "pretty" Setting

The new query parameter, pretty, enables or disables the pretty formatting of query results. Setting it to false disables pretty formatting of the query results and removes all occurrences of white space characters from the query results. This reduces the number of bytes transferred to the client applications and improves the query response time. The performance benefits are significantly visible when working with large result sets. For more information, see N1QL REST API.

Non-blocking DISTINCT Operator with Streaming Capability

Typically, DISTINCT operator used in queries is blocking in nature. N1QL enhances the DISTINCT operator to stream query output while it is still processing the input. It preserves the order of input and consequently retains and leverages the index-order of the documents. The operator processing uses less memory resources, making it more efficient. This enhancement significantly improves the response times seen by applications as they start receiving query results as soon as the results are available, while N1QL is still processing subsequent results.

This optimization is applicable to usage of DISTINCT in various scenarios such as query projections, UNION queries, and part of INTERSECT, INTERSECT ALL, EXCEPT, EXCEPT ALL etc.

Efficient Memory Usage for Processing Projections

Processing projections in queries is a memory intensive operation, especially when using the wildcard character *. N1QL has optimized the memory allocation and memory usage algorithm to consume considerably less memory and thus process data more efficiently.

Optimization for Processing IN Operator with Parameters

N1QL has optimized and improved the usage of available secondary indexes when the IN clause is used with parameters. It passes precise spans to the indexer to efficiently lookup the required from the indexer. For example, the following query shows the optimized plan to efficiently lookup the required data:

EXPLAIN SELECT x FROM default WHERE x in ["5", $1];

Simplified Transitioning from RDBMS to NoSQL

New String Function SUFFIXES() for Efficient Pattern Matching

The new function SUFFIXES() produces all possible suffix substrings of a given string. For example, SUFFIXES("N1QL") produces the following array of substrings: SUFFIXES("N1QL") = [ "N1QL", "1QL", "QL", "L" ].

While the core functionality is simple, it is immensely helpful in improving the performance of pattern matching with LIKE "%substring%" queries. See SUFFIXES() for more information.

Enhanced UPDATE Statement to Work with Nested Arrays

The UPDATE statement has been improved to SET nested array elements. The FOR clause is enhanced to evaluate functions and expressions, and the new syntax supports multiple nested FOR expressions to access and update fields in nested arrays. Additional array levels are supported by chaining the FOR clauses.

UPDATE default
SET i.subitems = ( ARRAY OBJECT_ADD(s, 'new', 'new_value' )
  FOR s IN i.subitems END )
      FOR i IN items END, 1) END;
New Array Function ARRAY_INTERSECT()

The ARRAY_INTERSECT() function takes two or more arrays as parameters and returns the intersection of the input arrays as the result, that is, the array containing values that are present in all the input arrays. It returns an empty array if there are no common array elements. For more information, see ARRAY_INTERSECT().

Simplified Dynamic Object Construction

N1QL simplifies dynamic object creation in the queries.

  • When constructing objects in a N1QL query, the names of fields in the name-value pairs can be dynamically generated. Starting from release 4.5.1, both the names and values can be arbitrary expressions. If a name does not evaluate to a string, the result of the object construction is NULL. For example:

    SELECT { UPPER("a") || "_key" : 1 + 2 } AS myobj;
        "myobj": {
            "A_key": 3
  • When constructing objects in a N1QL query, the names of fields in name-value pairs is made optional starting release 4.5.1. For example, the following query is valid in 4.5.1 and implicitly assigns names "type" and "name" for respective values:

    SELECT {type, name} AS myobj FROM `travel-sample` LIMIT 1;
           "type": "airport"
           "name": "airport_123"

For more information, see Construction Operators.

Release 4.5.0

With version 4.5, Couchbase Server advances in the following major categories:

See Release 4.5.0 for information on the changes in behavior and the fixed and known issues for this release.

Higher Performance Data Access & Query

Higher performance directly translates to better user experience and significant cost savings as each added node delivers better throughput. Couchbase Server version 4.5 enables performance, in some cases by an order of magnitude, with enhancements to core data operations, indexing and query execution. These, along with optimizations added in version 4.1 such as prepared execution of N1QL statements and covering indexes, give querying and indexing a significant boost.

Fast Partial Reads and Writes to JSON Documents

With the extended sub-document APIs for data service developers can operate on parts of a document without having to send the entire document back and forth between a client and server. This results in a significant performance gain and reduced network overhead with large documents. For more information, see Sub-Document Operations.

Memory-Optimized Global Indexes

Version 4 of Couchbase Server introduced Global Secondary Indexes (GSIs) which are independently partitioned away from data for faster N1QL queries. Couchbase Server 4.5 provides additional tuning for index processing and index scans. The new memory-optimized indexing provide an order of magnitude improvement to query latencies and fresher index under heavy mutation rates (INSERT/UPDATE/DELETE). Unlike other databases, Couchbase Server global secondary indexes are built to isolate the impact of indexing on performance of mutations, data ingest, and bulk data modifications using N1QL INSERT, UPDATE, DELETE and MERGE statements. Couchbase Server 4.5 memory-optimized indexes further enhances index processing and isolation of impact of indexing on the data ingest and query workloads.

You can enable the new memory-optimized global secondary indexes through the index settings under the Settings tab in the Couchbase Server Web Console. For more information, see Memory-Optimized Global Indexes.

Array Indexing for Nested Data Structured in JSON Documents

N1QL provides a considerable number of "verbs" to process embedded structures and arrays such as UNNEST and ANY/EVERY operators. With the new array indexing feature developers can optimize the execution of queries. The new index can optimize queries that are looking for specific array elements and can result in multiple orders of magnitude improvement on query latency and throughput. Arrays are indexed using the new ARRAY keyword in CREATE INDEX statement in N1QL. For more information, see Array Indexing.

Faster Read-Your-Own-Write (RYOW) Consistency with N1QL Queries

Tunable consistency for N1QL and MapReduce queries helps improve the query performance. Using the previous versions, you could query data using eventual or strict consistency flag. RYOW consistency provides the optimization required by applications that have to deal with high mutation rates but cannot compromise on consistency guarantees. With strictly consistent queries, the staleness parameter is set to false per query, which ensures that the query uses the request timestamp token to generate the results. With version 4.5, you can choose to get consistency aligned to the timestamp of your last update which result in lower latency response times for your queries. See Querying Data and Query Data Service for details.

Improved Index IO Performance with Circular Writes

Global Secondary Indexes (GSI) use the new ForestDB engine for index storage. ForestDB uses an append-only write architecture that requires frequent full compactions to clean up orphaned pages in the index file. With version 4.5, ForestDB introduces circular writes as a new write mode for standard global secondary indexes. Circular write mode reduces the IO bandwidth demands for indexes and reduces the requirement to run frequent full compaction operations. See Writes with Circular Reuse for more information.

Index JOINs in N1QL

With version 4.5, N1QL introduces an extended JOIN syntax for added flexibility in JOINs. The new JOIN ON KEYFOR keyword allows developers to specify JOIN operations that can use the left or the right keyspace for the JOIN. With the extended syntax, N1QL also makes better use of indexes to perform the JOIN operation faster across the two sides, and substantially lowers JOIN latencies. For more information, see Index Joins.

Simplified Transitioning from RDBMS to NoSQL

The query language N1QL, introduced in Couchbase Server 4.0, enabled developers and admins to use their SQL skills to access and query JSON data. Couchbase Server 4.5 builds on N1QL and adds new features that make it even easier to introduce NoSQL into an existing architecture, and give developers and admins greater confidence in making the transition.

Integrated Query Workbench

Couchbase Server 4.5 also provides a simple and visual way to develop and design queries with auto-complete for your N1QL statements. Query Workbench also allows the ad-hoc execution of queries directly from the Web console. Query results are displayed in JSON, table or tree formats and can be saved. To use the new integrated Query Workbench, switch to the new Query tab in the Couchbase Server Web Console. For more information, see Query Workbench.

Auto Schema Discovery

The new "bucket analyzer" and the new INFER N1QL command, can peek into your bucket data to infer schemas by sampling a portion of your document data. Schema discovery tools simplify detecting document and data types, type drifts and data distribution for developers and admins. For more information, see the INFER command reference.

Enhanced Query Monitoring

In Couchbase Server 4.5, N1QL adds several new keyspaces under the "system:" namespace. The new keyspaces allow monitoring "active requests", "completed requests", system information and more. For a full list of new system keyspaces added to N1QL, see Query Monitoring.

Advanced Command-line Tooling for Query

In previous releases, the cbq command line tool has been the central point for executing N1QL queries. Command line access to N1QL has been greatly improved in this release, and the new command line access provides smart connection management and full scriptability with version 4.5. For more information, see cbq: The Command Line Shell for N1QL.

Enhanced N1QL Functions

N1QL enhancements such as array insert function, object add, put, and remove functions, and more.

  • Array insert function to insert a value into a specific position in an array and return the new array. See Array Functions for details.

  • New functions to add, put, and remove objects. See Object Functions for details.

  • Duration to string conversion functions: Durations have been used consistently in the body of the results document (for example, elapsedTime) but now are also used in some keyspaces such as active_requests and completed_requests. The conversion functions support nano- (ns) , micro- ( μs), milli- (ms) and second (s) time units. See Date Functions for details.

Integrated Full Text Search (FTS) and new Full Text Search Service [Developer Preview]

Full Text Search (FTS) enables you to create, manage, and query full text indexes on JSON documents stored in a Couchbase bucket. FTS provides a language-aware manner of searching with relevance ranking (scoring) for results.

The Full Text Search feature is still considered experimental and the UI or the functionality may change. The What’s New? page lists the FTS features added in this release.

For more information on search service and full-text search, see Full Text Search Reference.

Enhanced Management & Security Controls

Taming big data can be a challenge. With 4.5, administering large cluster with over 100 nodes gets much more robust. For larger datasets, Couchbase Server brings in new disaster recovery capabilities that minimizes the windows of data loss and unavailability. The new enterprise backup and restore capability can operate on the same data with much higher performance.

With mission critical applications deployed on Couchbase governance becomes an increasingly critical function. In addition to encryption and auditing capabilities available in previous versions, Couchbase Server 4.5 brings a great deal of new roles based controls for administrators to enhance simplified governance.

Docker in Production

Docker provides high performance container technology for agile and portable deployments. With Couchbase Server 4.5, Couchbase Server now supports deploying Couchbase Server in production with Docker containers. See Getting Started with Server on Docker Containers and Planning for Production for more information.

X509 Certificates

With Couchbase Server 4.5, you can now use X.509 certificates from your own certificate authority for encryption. X.509 certificates provide strongly trusted, on-the-wire encryption for client-server communication and across data centers. The new capability also makes it simple for administrators to manage and rotate certificates without application downtime. You can find detailed information about X.509 certificates here.

Role-Based Access Control for Administrators

With version 4.5, Couchbase Server provides Role-Based Access Control for administrators. Aside from the existing encryption and auditing facilities, RBAC provides fine grain control over administrative access and simplifies compliance with governance rules. You can control administrative roles from the Settings tab in the Web Console. See Role-Based Access Control (RBAC) for Administrators for details.

Enterprise Backup and Restore

Couchbase Server 4.5 provides a new enterprise backup and restore tool that can back up larger datasets with significantly higher performance than before. The scalable, high-performance backup and restore tool allows Couchbase Server to provide faster and more scalable recovery options to better integrate with Disaster Recovery planning. See cbbackupmgr Tool for detailed information.