CBLDocument

@interface CBLDocument : CBLReadOnlyDocument <CBLDictionary>

A Couchbase Lite document.

  • Creates a new CBLDocument object with a new random UUID. The created document will be saved into a database when you call the CBLDatabase’s -save: method with the document object given.

    Declaration

    Objective-C

    + (nonnull instancetype)document;
  • Creates a new CBLDocument object with the given ID. If a nil ID value is given, the document will be created with a new random UUID. The created document will be saved into a database when you call the CBLDatabase’s -save: method with the document object given.

    Declaration

    Objective-C

    + (nonnull instancetype)documentWithID:(nullable NSString *)documentID;

    Parameters

    documentID

    The document ID.

  • Initializes a new CBLDocument object with a new random UUID. The created document will be saved into a database when you call the CBLDatabase’s -save: method with the document object given.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Initializes a new CBLDocument object with the given ID. If a nil ID value is given, the document will be created with a new random UUID. The created document will be saved into a database when you call the CBLDatabase’s -save: method with the document object given.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithID:(nullable NSString *)documentID;

    Parameters

    documentID

    The document ID.

  • Initializes a new CBLDocument object with a new random UUID and the dictionary as the content. Allowed dictionary value types are NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString, CBLArray, CBLBlob, CBLDictionary. The NSArrays and NSDictionaries must contain only the above types. The created document will be saved into a database when you call the CBLDatabase’s -save: method with the document object given.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDictionary:
        (nonnull NSDictionary<NSString *, id> *)dictionary;

    Parameters

    dictionary

    The dictionary object.

  • Initializes a new CBLDocument object with a given ID and the dictionary as the content. If a nil ID value is given, the document will be created with a new random UUID. Allowed dictionary value types are NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString, CBLArray, CBLBlob, CBLDictionary. The NSArrays and NSDictionaries must contain only the above types. The created document will be saved into a database when you call the CBLDatabase’s -save: method with the document object given.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithID:(nullable NSString *)documentID
                            dictionary:
                                (nonnull NSDictionary<NSString *, id> *)dictionary;

    Parameters

    documentID

    The document ID.

    dictionary

    The dictionary object.