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!
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 queries</b
Database 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).
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.
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