swiftindexingcouchbase-lite

Couchbase Lite Swift - Indexing on optional property


I need to index a property in a Couchbase Lite database, and the property is optional, i.e. not present in all documents. I wanted to know if this kind of indexing is supported in Couchbase Lite.


Solution

  • Yes.

    It is entirely possible to put an index on a property that is not present in all documents or a property whose value is nil in some documents.

    Documents with properties like that might be represented in Swift, as Optionals.