CBLSubdocument

@interface CBLSubdocument : CBLProperties

CBLSubdocument is a suboducment or a nested document with its own set of named properties. In JSON terms it’s a nested JSON Map object. Like CBLDocument, CBLSubdocument is mutable, so you can make changes in-place. The difference is that a subdocument doesn’t have its own ID. It’s not a first-class entity in the database, it’s just a nested object within the document’s JSON. It can’t be saved individually; changes are persisted when you save its document.

  • The document that the subdocument belong to.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) CBLDocument *document;

    Swift

    var document: CBLDocument? { get }
  • Checks whether the subdocument exists in the database or not.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL exists;

    Swift

    var exists: Bool { get }
  • Create a new subdocument.

    Declaration

    Objective-C

    + (nonnull instancetype)subdocument;
  • Initializes a new subdocument.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()
  • Same as objectForKey:

    Declaration

    Objective-C

    - (nullable id)objectForKeyedSubscript:(nonnull NSString *)key;

    Swift

    subscript(key: String) -> Any? { get set }
  • Same as setObject:forKey:

    Declaration

    Objective-C

    - (void)setObject:(nullable id)value forKeyedSubscript:(nonnull NSString *)key;