Ditto 3.0.10
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
DittoSDK.DittoDocumentId Class Reference

An identifier for a DittoDocument More...

Public Member Functions

 DittoDocumentId (object value)
 Initializes a new instance of the DittoDocumentId class.
 
override bool Equals (object other)
 Returns whether or not two DittoDocumentIds are equal.
 
override int GetHashCode ()
 
override string ToString ()
 Returns a stringified representation of a document identifier.
 

Properties

object Value [get]
 Gets the underlying value of the document identifier as a native type.
 
string String [get]
 Gets the underlying value of the document identifier as a string if possible, otherwise the return value will be null.
 
string StringValue [get]
 Gets the underlying value of the document identifier as a string if possible, otherwise the return value will be "" (an empty string).
 
int Int32Value [get]
 Gets the underlying value of the document identifier as an Int32 if possible, otherwise the return value will be 0.
 
long Int64Value [get]
 Gets the underlying value of the document identifier as an Int64 if possible, otherwise the return value will be 0.
 
uint UInt32Value [get]
 Gets the underlying value of the document identifier as a UInt32 if possible, otherwise the return value will be 0.
 
ulong UInt64Value [get]
 Gets the underlying value of the document identifier as a UInt64 if possible, otherwise the return value will be 0.
 
bool BooleanValue [get]
 Gets the underlying value of the document identifier as a bool if possible, otherwise the return value will be false.
 
List< object > List [get]
 Gets the underlying value of the document identifier as a List<object> if possible, otherwise the return value will be null.
 
List< object > ListValue [get]
 Gets the underlying value of the document identifier as a List<object> if possible, otherwise the return value will be [] (an empty list).
 
Dictionary< string, object > Dictionary [get]
 Gets the underlying value of the document identifier as a Dictionary<string, object> if possible, otherwise the return value will be null.
 
Dictionary< string, object > DictionaryValue [get]
 Gets the underlying value of the document identifier as a Dictionary<string, object> if possible, otherwise the return value will be {} (an empty dictionary).
 
DittoDocumentIdPath this[string path] [get]
 Used to specify a path to a key in the document identifier that you can subscript further to access a nested key in the document identifier, if necessary.
 
DittoDocumentIdPath this[int index] [get]
 Used to specify an index in the array that represents the document identifier. You can subscript the return value further to access a further nested key in the document identifier, if necessary.
 

Detailed Description

An identifier for a DittoDocument

Each DittoDocumentId represents a unique identifier for a document.

Constructor & Destructor Documentation

◆ DittoDocumentId()

DittoSDK.DittoDocumentId.DittoDocumentId ( object  value)
inline

Initializes a new instance of the DittoDocumentId class.

A document identifier 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 identifier.

Document identifiers 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 identifier that exceeds the size limit.

Parameters
valueThe value that represents the document identifier.

Member Function Documentation

◆ Equals()

override bool DittoSDK.DittoDocumentId.Equals ( object  other)
inline

Returns whether or not two DittoDocumentIds are equal.

Parameters
otherThe other DittoDocumentId to compare against for equality.
Returns
A bool denoting whether or not the DittoDocumentIds were equal.

◆ ToString()

override string DittoSDK.DittoDocumentId.ToString ( )
inline

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($"_id == {docId.ToString()}")

Returns
An stringified representation of the document identifier.

Property Documentation

◆ this[int index]

DittoDocumentIdPath DittoSDK.DittoDocumentId.this[int index]
get

Used to specify an index in the array that represents the document identifier. You can subscript the return value further to access a further nested key in the document identifier, if necessary.

Parameters
indexThe index of the array representing the document identifier that you wish to access.
Returns
A DITDocumentIdPath object with the provided index incorporated into the document identifier path.

◆ this[string path]

DittoDocumentIdPath DittoSDK.DittoDocumentId.this[string path]
get

Used to specify a path to a key in the document identifier that you can subscript further to access a nested key in the document identifier, if necessary.

Parameters
pathThe initial part of the path needed to get to the key in the document identifier you wish to get the value of.
Returns
A DittoDocumentIdPath object with the provided key incorporated into the document identifier path.