Class ModifyStatement<T>
Represents a chaining collection modify statement.
Namespace: MySqlX.XDevAPI.CRUD
Assembly: MySql.Data.dll
Version: 9.1.0
Syntax
public class ModifyStatement<T> : FilterableStatement<ModifyStatement<T>, Collection<T>, Result, T>
Type Parameters
Name | Description |
---|---|
T |
Methods
ArrayAppend(String, Object)
Appends an item to the specified array.
Declaration
public ModifyStatement<T> ArrayAppend(string docPath, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | docPath | The document path key. |
System.Object | value | The value to append to the array. |
Returns
Type | Description |
---|---|
ModifyStatement<T> | A ModifyStatement<T> object containing the updated array. |
ArrayInsert(String, Object)
Inserts an item into the specified array.
Declaration
public ModifyStatement<T> ArrayInsert(string field, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | field | The document path key including the index on which the item will be inserted. |
System.Object | value | The value to insert into the array. |
Returns
Type | Description |
---|---|
ModifyStatement<T> | A ModifyStatement<T> object containing the updated array. |
Change(String, Object)
Changes value for a key.
Declaration
public ModifyStatement<T> Change(string docPath, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | docPath | The document path key. |
System.Object | value | The new value. |
Returns
Type | Description |
---|---|
ModifyStatement<T> | This ModifyStatement<T> object. |
Execute()
Executes the modify statement.
Declaration
public override Result Execute()
Returns
Type | Description |
---|---|
Result | A Result object containing the results of the execution. |
Overrides
Patch(Object)
Creates a ModifyStatement<T> object set with the changes to be applied to all matching documents.
Declaration
public ModifyStatement<T> Patch(object document)
Parameters
Type | Name | Description |
---|---|---|
System.Object | document | The JSON-formatted object describing the set of changes. |
Returns
Type | Description |
---|---|
ModifyStatement<T> | A ModifyStatement<T> object set with the changes described in |
Remarks
document
can be a DbDoc object, an anonymous object, a JSON string or a custom type object.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
Set(String, Object)
Sets key and value.
Declaration
public ModifyStatement<T> Set(string docPath, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | docPath | The document path key. |
System.Object | value | The new value. |
Returns
Type | Description |
---|---|
ModifyStatement<T> | This ModifyStatement<T> object. |
Sort(String[])
Allows the user to set the sorting criteria for the operation. The strings use normal SQL syntax like "order ASC" or "pages DESC, age ASC".
Declaration
public ModifyStatement<T> Sort(params string[] order)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | order | The order criteria. |
Returns
Type | Description |
---|---|
ModifyStatement<T> | A generic object representing the implementing statement type. |
Unset(String[])
Removes keys or values from a document.
Declaration
public ModifyStatement<T> Unset(params string[] docPath)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | docPath | An array of document paths representing the keys to be removed. |
Returns
Type | Description |
---|---|
ModifyStatement<T> | This ModifyStatement<T> object. |
Where(String)
Enables the setting of Where condition for this operation.
Declaration
[Obsolete("Where(string condition) has been deprecated since version 8.0.17.")]
public ModifyStatement<T> Where(string condition)
Parameters
Type | Name | Description |
---|---|---|
System.String | condition | The Where condition. |
Returns
Type | Description |
---|---|
ModifyStatement<T> | The implementing statement type. |