DITDocumentID

@interface DITDocumentID : NSObject <NSCopying>

An identifier for a DITDocument.

Each DITDocumentID represents a unique identifier for a document.

  • Initializes a new DITDocumentID.

    A document ID can be created from any of the following:

    • string
    • integer
    • boolean
    • null
    • byte array
    • array (containing any of the items in this list)
    • map (where the keys must be strings and the values can be made up of any of the items in this list)

    Note that you cannot use floats or other custom types to create a document ID.

    Document IDs are also limited in size, based on their serialized representation, to 256 bytes. You will receive an error if you try to create a document ID that exceeds the size limit.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithValue:(nonnull id)idValue;

    Parameters

    idValue

    The value that represents the document identifier.

  • Returns a stringified representation of a document identifier.

    The returned string can be used directly in queries that you use with other Ditto functions. For example you could create a query that was like this:

    [myCollection find:[NSString stringWithFormat:@"_id == %@", [docID toString]];
    

    Declaration

    Objective-C

    - (nonnull NSString *)toString;

    Return Value

    An NSString representation of the document identifier.

  • Returns a native representation of a document identifier.

    Declaration

    Objective-C

    - (nonnull NSObject *)toNative;

    Return Value

    An NSObject representation of the document identifier.

  • Compares two documents and determines whether or not they are equal.

    Declaration

    Objective-C

    - (BOOL)isEqualToDITDocumentID:(nonnull DITDocumentID *)documentID;

    Parameters

    documentID

    The other document identifier that you want to test equality with.

    Return Value

    A BOOL representing whether or not the document identifiers are equal.

  • Compares two documents and determines their relative ordering.

    Declaration

    Objective-C

    - (NSComparisonResult)compare:(nonnull DITDocumentID *)documentID;

    Parameters

    documentID

    The other document identifier that you want to comapre against.

    Return Value

    An NSComparisonResult representing the ordering of the document identifiers when compared.