Couchbase Mobile 2.0 is a groundbreaking new release for Couchbase Mobile. We’ve reimagined the developer experience with a cross-platform common core, new simplified API, and automated conflict resolution that can be customized. In this release, we are bringing N1QL queries and full-text search capabilities to mobile. Read on to learn all about the most advanced NoSQL mobile database on the planet!

Couchbase Lite

We have rewritten Couchbase Lite in the 2.0 version. The database core engine, internally referred to as “Couchbase Lite core,” has been implemented in C/C++. With a common core, the size of the codebase has been significantly reduced resulting in better manageability. It also allows for easy porting to low fidelity devices that enable new IoT use cases and opens new markets for Couchbase mobile developers.

There are language-specific bindings on top of the common core for iOS, .NET, and Java. During development, we’ve seen a 6x improvement in performance between 1.x and 2.0.

New simplified API

With built-in thread safety, mutable properties, typed accessors and blobs for accessing attachments, you will find the reimagined API easy to learn. We’ve gone through multiple iterations of the API as we engaged with our developer community early on. Your feedback has been invaluable in shaping the current revision of the APIs and we look forward to your continued support.

Fluent API for N1QL queriesDatabase queries have changed significantly in this release. Couchbase Lite 2.0 uses semantics based on the N1QL query language defined by Couchbase. The query API has two styles, builder and fluent, and the implementation chosen would depend on the development platform.

The API allows you to access multiple Couchbase Lite databases with cross-database joins. This API will be familiar if you’ve used Core Data, or other query APIs based on SQL (like jOOQ).

Full-text search

In this release, users can perform full-text searches on the JSON documents stored in Couchbase Lite. You can now bring to your mobile applications what Google, Yahoo, and Bing do with HTML on the web. The API for using full-text search is not very different from the query API – users can search for text, text fragments, and text connected by binary operators, and Couchbase Lite finds the set of JSON documents that best match those terms.

Replication

Couchbase Mobile 2.0 uses a new replication protocol, based on WebSockets. This protocol has been designed to be fast, efficient, easier to implement, and symmetrical between client/server. Even though the replication protocol has changed, Couchbase Lite 1.x clients will be able to work with Couchbase Mobile 2.0 deployments since Couchbase Sync Gateway continues to support both clients.

However, the new replication protocol is incompatible with version 1.x, and with CouchDB-based databases including PouchDB and Cloudant.

But the new replicator is faster than the old one – we’ve seen up to twice the speed on iOS devices, and even greater improvement on Android.

Automated conflict management

We’ve taken a completely different approach to conflict management. An application is no longer required to handle conflicts out of band and keep track of various conflicting revisions. Couchbase Lite 2.0 will detect a conflict while saving a document or during replication and invoke an app-defined conflict resolver. The conflict resolution is designed for flexibility that will allow developers to tailor it for their specific needs.

To get started  

Posted by Sachin Smotra

Sachin recently joined Couchbase where he is the lead product manager for initiatives in the Mobile and IOT space. Before joining Couchbase, Sachin spent 8 years at Cisco WebEx where he led the product team responsible for executing the vision for improved Customer Experience. He also launched the WebEx Social Developer Program to enable 3rd parties to expand the core collaboration offerings from Cisco. Prior to his time at Cisco, Sachin worked at different startups in roles across engineering, architecture, product management and alliances.

2 Comments

  1. Congratulations on the new release!

    I’m wondering about the replication protocol changes, though. Do they mean that I won’t ve able to use PouchDB with CouchBase Sync Gateway at all? Or is it just the replication that won’t work? Said differently, will the core CouchDB API (GET /db/:id, PUT /db/:id etc.) still be supported by Sync Gateway 2.0?

  2. Sachin Smotra May 29, 2017 at 5:58 pm

    @denisw – thanks!

    The existing Sync Gateway REST endpoint that is compatible with the CouchDB API will continue to be supported in Sync Gateway 2.0. All existing applications can continue to use the current REST API to replicate to Sync Gateway 2.0.

Leave a reply