Creates a new DocumentID
.
A document ID can be created from any of the following:
string
number
(integer)boolean
null
Array
(containing any of the items in this list)object
, 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.
The value that represents the document identifier.
Optional
skipCBOREncoding: booleanIf true, skips CBOR encoding and assumes the passed in
valueis already CBOR encoded. You shouldn't need to ever pass this parameter, it's only used internally for certain edge cases. @param skipValidation If
true, skips validation of the passed in value or
CBOR. You shouldn't need to ever pass this parameter, it's only used
internally for certain edge cases.
Optional
skipValidation: booleanReadonly
isReturns false
if validation has been skipped at construction time,
otherwise returns true
. This is mostly for internal use only, you
shouldn't need this in client code.
Returns the value of the receiver, lazily decoded from its CBOR representation if needed.
Returns true
if passed in documentID
is equal to the receiver,
otherwise returns false
.
Returns a query compatible string representation of the receiver.
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:
collection.find(`_id == ${documentID.toQueryCompatibleString()}`)
Represents a unique identifier for a Document.