You are viewing the documentation for a prerelease version.

View Latest

What’s New in Version 7.0 Beta?

    +

    Couchbase Server 7.0, now in Beta, introduces scopes and collections that provide new database organizaion structures within Couchbase. It also brings new capabilities to the Query Service in addition to support for scopes and collections.

    For more information about platform support changes, deprecation notifications, notable improvements, and fixed and known issues, refer to the release notes.

    New Features and Enhancements

    This section describes the new features and enhancements in this release.

    Scopes and Collections

    Couchbase Server provides scopes and collections; allowing documents to be categorized and organized, within a bucket.

    A collection is a data container, defined on Couchbase Server, within a bucket whose type is either Couchbase or Ephemeral. Bucket-items can optionally be assigned to different collections according to content-type. For example, within a bucket that contains travel information, documents that relate specifically to airports might be assigned to an airports collection, while documents that relate to hotels might be assigned to a hotels collection, and so on.

    A scope is a mechanism for the grouping of multiple collections. Collections might be assigned to different scopes according to content-type, or to deployment-phase (ie, test versus production). Applications can be assigned per-scope access-rights; allowing each application to access only those collections it requires.

    The benefits of scopes and collections include:

    • The logical grouping of similar documents; potentially simplifying operations such as query, XDCR, and backup and restore.

    • The increased efficiency of indexing, due to the Data Service being able to provide documents from specific collections to the Index Service.

    • Simplified querying, since query statements are able more easily to specify particular subsets of documents.

    • Easier migration from relational databases to Couchbase Server, since collections can be designed to correspond to pre-existing relational tables.

    • Secure isolation of different document-types, within a bucket; allowing applications to be specifically authorized to use only their appropriate subsets of data.

    A complete overview of scopes and collections is provided in Scopes and Collections.

    Creating Scopes and Collections

    Scopes and collections can be created by means of the Couchbase Web Console UI, the Couchbase CLI, the Couchbase REST API, and the N1QL query language. See Manage Scopes and Collections for instructions.

    Assigning Roles with Reference to Scopes and Collections

    Roles can be assigned to users with reference to specific scopes and collections, as well as to buckets. To see how this can be performed by means of the Couchbase Web Console UI, see Manage Users, Groups, and Roles.

    Importing Documents into Scopes and Collections

    Couchbase Server Version 7.0 allows documents to be imported into specific collections. For a step-by-step guide, see Import Documents.

    Getting Information on Scopes and Collections

    Information on currently defined scopes and collections can be returned by means of the cbstats collections, collections-details, scopes, and scopes-details commands. Additionally, collection-specific information on keys and vkeys can be returned, by means of the cbstats key and vkey commands, respectively.

    Using XDCR with Scopes and Collections

    XDCR can replicate to a specific scope or collection. Examples are provided in Replicate Using Scopes and Collections.

    Query Enhancements

    This release adds the following capabilities to the Query Service:

    Support for Scopes and Collections with N1QL

    In Couchbase Server 7.0 Beta, the N1QL query language supports a dotted path syntax for keyspace references to be able to access scopes and collections. In addition, a default query context can be specified through the Query Workbench or a request-level parameter, so that queries may refer to a collection directly without having to specify the path.

    The N1QL language also contains new statements for scope and collection management. Refer to CREATE SCOPE, CREATE COLLECTION, DROP SCOPE, and DROP COLLECTION.

    Couchbase Transactions with N1QL

    Couchbase Server 7.0 Beta extends the support of transactions to the N1QL query language. The support for multi-document ACID transactions was introduced in version 6.5 and the feature is available to application developers through Couchbase SDK and APIs.

    With this release, application developers and RDBMS users can use familiar transactional constructs such as START TRANSACTION, SAVEPOINT, ROLLBACK and COMMIT.  And, similar to RDBMS transactions, all N1QL DML statements support transactions.

    To learn more about using transactions with N1QL, see BEGIN TRANSACTION, COMMIT TRANSACTION, SAVEPOINT, ROLLBACK TRANSACTION, and SET TRANSACTION.

    Cost-based Optimizer

    The cost-based optimizer is generally available in Couchbase Server 7.0 Beta. This takes into account the cost of memory, CPU, network transport, and disk usage when choosing the optimal plan to execute a query.

    The cost-based optimizer uses metadata and statistics to estimate amount of processing (memory, CPU, and I/O) for each operation. It compares the cost of alternative routes, and then selects the query-execution plan with the least cost.

    The N1QL language includes a rich new syntax to gather, update, and delete statistics. Refer to UPDATE STATISTICS.

    Index Advisor

    The index advisor is generally available in Couchbase Server 7.0 Beta. As well as the ADVISE statement, the index advisor also supports the ADVISOR Function which enables users to generate index advice for every request in a session.

    The index advisor leverages the cost-based optimizer in the first instance, to generate advice using a cost-based approach. If the cost-based optimizer is unable to recommend an index, the index advisor falls back on a rules-based approach.

    User Defined Functions

    User-defined functions are generally available in Couchbase Server 7.0 Beta. These enable you to create functions for repetitive tasks. User-defined functions may be written in N1QL or in an external language — currently JavaScript is supported.

    User-defined functions may be stored at the bucket level or the scope level. This determines the context for keyspace references within the function definition.

    The N1QL language includes new statements to create, replace, execute, and drop user-defined functions. Refer to CREATE FUNCTION, EXECUTE FUNCTION, DROP FUNCTION, and User-Defined Functions.

    Memory Usage Quota Setting

    The Query Service supports several new node-level settings and request-level parameters to support transactions and collections. The Query Service also supports a new node-level and request-level Memory Quota setting, which enables users to specify the maximum document memory consumption for a query. Refer to Settings and Parameters for details.

    The Backup Service

    The Backup Service supports the scheduling of full and incremental data backups, either for specific individual buckets, or for all buckets on the cluster. It also allows the scheduling of merges of previously made backups. Data to be backed up can also be selected by service: for example, the data for the Data and Index Services alone might be selected for backup, with no other service’s data included.

    The service — which is also referred to as cbbs (Couchbase Backup Service) — can be configured and administered by means of the Couchbase Web Console UI, the CLI, or the REST API.

    A complete overview of the Backup Service is provided in Backup Service. Step-by-step instructions for using the service by means of Couchbase Web Console are provided in Manage Backup and Restore. A complete list of commands provided with the Couchbase REST API for the Backup Service is provided in Backup Service API.