CBLMutableDocument

@interface CBLMutableDocument : CBLDocument <CBLMutableDictionary>

The mutable version of the CBLDocument.

  • Creates a new CBLMutableDocument 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 CBLMutableDocument 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 CBLMutableDocument 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 CBLMutableDocument 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 CBLMutableDocument object with a new random UUID and the data. Allowed data value types are CBLArray, CBLBlob, CBLDictionary, NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString. 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)initWithData:
        (nonnull NSDictionary<NSString *, id> *)data;

    Parameters

    data

    The data.

  • Initializes a new CBLMutableDocument object with the JSON data.

    Declaration

    Objective-C

    - (nullable instancetype)initWithJSON:(nonnull NSString *)json
                                    error:(NSError *_Nullable *_Nullable)error;

    Parameters

    json

    The JSON string with data.

    error

    On return, the error if any.

    Return Value

    The CBLMutableDocument object, nil in case of JSON Error .

  • Initializes a new CBLMutableDocument object with the given ID and the data. If a nil ID value is given, the document will be created with a new random UUID. Allowed data value types are CBLMutableArray, CBLBlob, CBLMutableDictionary, NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString. 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
                                  data:(nonnull NSDictionary<NSString *, id> *)data;

    Parameters

    documentID

    The document ID.

    data

    The data.

  • Initializes a new CBLMutableDocument object with the given ID and the JSON data. If a nil ID value is given, the document will be created with a new random UUID.

    Declaration

    Objective-C

    - (nullable instancetype)initWithID:(nullable NSString *)documentID
                                   json:(nonnull NSString *)json
                                  error:(NSError *_Nullable *_Nullable)error;

    Parameters

    documentID

    The document ID.

    json

    The JSON string with data.

    error

    On return, the error if any.

    Return Value

    The CBLMutableDocument object, nil in case of JSON Error .