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. @result the CBLDocument object.
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. - parameter: documentID the document ID. @result the CBLDocument object.
Declaration
Objective-C
+ (nonnull instancetype)documentWithID:(nullable NSString *)documentID;
Parameters
documentID
-
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. @result the CBLDocument object.
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. - parameter: documentID the document ID. @result the CBLDocument object.
Declaration
Objective-C
- (nonnull instancetype)initWithID:(nullable NSString *)documentID;
Parameters
documentID
-
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. - parameter: dictionary the dictionary object. @result the CBLDocument object.
Declaration
Objective-C
- (nonnull instancetype)initWithDictionary: (nonnull NSDictionary<NSString *, id> *)dictionary;
Parameters
dictionary
-
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. - parameter: documentID the document ID. - parameter: dictionary the dictionary object. @result the CBLDocument object.
Declaration
Objective-C
- (nonnull instancetype)initWithID:(nullable NSString *)documentID dictionary: (nonnull NSDictionary<NSString *, id> *)dictionary;
Parameters
documentID
dictionary