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.
If true, skips CBOR encoding and assumes the passed in
value` is already CBOR encoded. You shouldn't need to ever
pass this parameter, it's only used internally for certain edge cases.
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 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.toString()}`)
Represents a unique identifier for a Document.