Couchbase Lite Developer Build 003 for Objective-C, Swift, and .NET
Couchbase recently announced that Couchbase Lite Developer Build 003 is available for download for Objective-C, Swift, and .NET. Learn about the changes here.
I am very pleased that Couchbase Lite Developer Build 003 is now available for download for Objective-C, Swift, and .NET.
Database queries have changed significantly in this release. Couchbase Lite 2.0 uses semantics based on N1QL query language defined by Couchbase. This API will be familiar If you’ve used Core Data or other query APIs based on SQL (like jOOQ).
The Query API will have two styles — builder and fluent — and the implementation chosen depends on the development platform.
For Objective-C, we’ve implemented a builder API.
The SQL statement:
‘SELECT * FROM type=’account’ AND owner=’John’ ORDER BY dealSize’
...can be written with the builder API as follows:
CBLQuery *query = [CBLQuery select: [CBLQuerySelect all] from: [CBLQueryDataSource database: database] where: [[CBLQueryExpression property: @”type”] equalTo: @”account”] and: [CBLQueryExpression property: @”owner”] equalTo: @”Wayne”]] orderBy: [CBLQueryOrderBy expression: [CBLQueryExpression property: @”dealSize”]] ];
The API Specification for Objective-C is available here and the release notes are here.
We’ve implemented a fluent API with support for the following:
- CRUD operations.
- Document with property type accessors.
- Subdocument API.
- Blob data type.
- CouchbaseLiteSwift framework for the Swift API.
- Database and document change notification.
The API Specification for Swift is available here and the release notes are here.
The major changes in .NET are as follows:
- We’ve added the sub-document API, which allows you to access embedded JSON objects. This is a much cleaner and safer approach with type-safe accessors and the thread safety rules.
- Thread safety checking is optional now. When used, it will be rigorously enforced and fail quickly to indicate incorrect usage.
- Plus, you get everything that was available in DB002 which is listed here. The key highlights are:
- A new and simplified API to interact with Couchbase Lite. CRUD operations are available and each subsequent build will have API expansion and changes. More details are available here.
- Blob data type support.
- Database and document change notifications.
We are working hard on creating samples for you, but in the meanwhile, you can check out the unit tests here to get started.
The API specification is available here and the release notes are available here.