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 would depend on the development platform.

Objective C

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.

Swift

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.

.NET

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 being:
    • 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.

Author

Posted by Madhuram Gupta

Leave a reply