Exposes functionality that allows you to perform multiple operations on the store within a single write transaction.
More...
|
unsafe DittoDocumentID | Upsert (Dictionary< string, object > data, DittoWriteStrategy writeStrategy=DittoWriteStrategy.Merge) |
| Inserts a new document into the collection and returns its ID. If the document already exists, the behavior is determined by the given writeStrategy . More...
|
|
unsafe DittoDocumentID | Insert (Dictionary< string, object > data, DittoDocumentID id=null, bool isDefault=false) |
| Inserts a document into a collection. More...
|
|
unsafe DittoDocumentID | InsertWithStrategy (Dictionary< string, object > data, DittoDocumentID id=null, DittoWriteStrategy writeStrategy=DittoWriteStrategy.Overwrite) |
| Inserts a document into a collection. More...
|
|
DittoWriteTransactionPendingCursorOperation | Find (string query) |
| Creates a cursor for the documents in this collection that match the provided query. More...
|
|
DittoWriteTransactionPendingCursorOperation | Find (string query, Dictionary< string, object > queryArgs) |
| Creates a cursor for the documents in this collection that match the provided query, with any placeholders replaced by the relevant provided query arguments. More...
|
|
DittoWriteTransactionPendingCursorOperation | FindAll () |
| Creates a cursor for all of the documents in this collection. More...
|
|
DittoWriteTransactionPendingIDSpecificOperation | FindById (DittoDocumentID id) |
| Creates an accessor for a single document by its unique identifier. More...
|
|
|
string | CollectionName [get] |
| Gets the name of the collection that the scoped write transaction is scoped to.
|
|
Exposes functionality that allows you to perform multiple operations on the store within a single write transaction.
A DittoScopedWriteTransaction
is scoped to a specific collection, obtained by calling DittoWriteTransaction.Scoped(string).
◆ Find() [1/2]
Creates a cursor for the documents in this collection that match the provided query.
- Parameters
-
query | A ditto query string. |
- Returns
- A cursor for the query.
◆ Find() [2/2]
Creates a cursor for the documents in this collection that match the provided query, with any placeholders replaced by the relevant provided query arguments.
This is the recommended method to use when performing queries on a collection if you have any dynamic data included in the query string. It allows you to provide a query string with placeholders, in the form of $args.my_arg_name
, along with an accompanying dictionary of arguments, in the form of { "my_arg_name": "some value" }
, and the placeholders will be appropriately replaced by the matching provided arguments from the dictionary. This includes handling things like wrapping strings in quotation marks and arrays in square brackets, for example.
- Parameters
-
query | A ditto query string. |
queryArgs | The arguments to use to replace placeholders in the provided query. |
- Returns
- A cursor for the query.
◆ FindAll()
Creates a cursor for all of the documents in this collection.
- Returns
- A cursor for all documents in the collection.
◆ FindById()
Creates an accessor for a single document by its unique identifier.
- Parameters
-
id | The id of the document in this collection. |
- Returns
- A cursor for a single document.
◆ Insert()
unsafe DittoDocumentID DittoSDK.DittoScopedWriteTransaction.Insert |
( |
Dictionary< string, object > |
data, |
|
|
DittoDocumentID |
id = null , |
|
|
bool |
isDefault = false |
|
) |
| |
|
inline |
Inserts a document into a collection.
- Parameters
-
data | The document content. |
id | The primary key or identifier for this document. If this is null then Ditto will assign it a unique identifier. This cannot be changed once inserted. |
isDefault | Set to true if the document should assume all values are default. See https://docs.ditto.live/concepts/data-model. |
- Returns
- The unique identifier of the document.
◆ InsertWithStrategy()
Inserts a document into a collection.
- Parameters
-
data | The document content. |
id | The primary key or identifier for this document. If this is null then Ditto will assign it a unique identifier. This cannot be changed once inserted. |
writeStrategy | Specifies the desired strategy for inserting a document. The default value is DittoWriteStrategy.Overwrite . |
- Returns
- The unique identifier of the document.
◆ Upsert()
Inserts a new document into the collection and returns its ID. If the document already exists, the behavior is determined by the given writeStrategy
.
- Parameters
-
data | The document content. |
writeStrategy | Specifies the desired strategy for inserting a document. The default value is DittoWriteStrategy.Merge . |
- Returns
- The unique identifier of the document.