Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDoc-2849 [Node.js] Document extensions > Time series > Client API > Operations > Patch [Replace C# samples] #1846

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ In this page:

{CODE [email protected] /}

| Parameter | | |
| ------------- | ------------- | ----- |
| **queryToUpdate** | `string` or `IndexQuery` | RQL query defining the update operation. The RQL query starts as any other RQL query with "from" and "update" statements. Later, it continues with an "update" clause in which you describe the Javascript patch code
| **options** | `QueryOperationOptions` | Options defining how the operation will be performed and various constraints on how it is performed
| Parameter | Type | Description |
|-------------------|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **queryToUpdate** | `string` | The query & patch definition.<br>The RQL query starts as any other RQL query with a "from" statement.<br>It continues with an "update" clause that contains the Javascript patching code. |
| **queryToUpdate** | `IndexQuery` | Object containing the query & the patching string,<br>with the option to use parameters. |
| **options** | `QueryOperationOptions` | Options defining how the operation will be performed and various constraints on how it is performed.<br>Default: `null` |

{PANEL/}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ update {

{CODE:nodejs syntax_2@client-api\operations\patches\setBasedPatchRequests.js /}

| Parameter | Type | Description |
|-------------------|--------------|------------------------------------------------------------|
| __queryToUpdate__ | `string` | The query & patch definition. |
| __queryToUpdate__ | `IndexQuery` | Object that allows adding parameters to the query & patch. |
| __options__ | `object` | Options for the _PatchByQueryOperation_. |
| Parameter | Type | Description |
|-------------------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| __queryToUpdate__ | `string` | The query & patch definition.<br>The RQL query starts as any other RQL query with a "from" statement.<br>It continues with an "update" clause that contains the Javascript patching code. |
| __queryToUpdate__ | `IndexQuery` | Object containing the query & the patching string,<br>with the option to use parameters. |
| __options__ | `object` | Options for the _PatchByQueryOperation_. |


{CODE:nodejs syntax_3@client-api\operations\patches\setBasedPatchRequests.js /}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ The patch request will be sent to the server only when calling `SaveChanges`, th
`Session.Advanced.Defer`
{CODE patch_non_generic_interface_in_session@ClientApi\Operations\Patches\PatchRequests.cs /}

{INFO: PatchCommandData}
{INFO: }

#### PatchCommandData

| Constructor | Type | Description |
|--------------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -196,15 +198,17 @@ The patch request will be sent to the server only when calling `SaveChanges`, th

{INFO/}

{INFO: PatchRequest}
{INFO: }

#### PatchRequest

We highly recommend using scripts with parameters. This allows RavenDB to cache scripts and boost performance.
Parameters can be accessed in the script through the `args` object and passed using PatchRequest's "Values" parameter.

| Members | Type | Description |
|------------|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Script** | `string` | JavaScript code to be run. |
| **Values** | `Dictionary<string, object>` | Parameters to be passed to the script. The parameters can be accessed using the '$' prefix. Parameter starting with a '$' will be used as is, without further concatenation. |
| Property | Type | Description |
|------------|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Script** | `string` | The patching script, written in JavaScript. |
| **Values** | `Dictionary<string, object>` | Parameters to be passed to the script.<br>The parameters can be accessed using the '$' prefix.<br>Parameter starting with a '$' will be used as is, without further concatenation. |

{INFO/}

Expand All @@ -221,13 +225,13 @@ An operations interface that exposes the full functionality and allows performin

{INFO: PatchOperation}

| Constructor| Type | Description |
|--------|:-----|-------------|
| **id** | `string` | ID of the document to be patched. |
| **changeVector** | `string` | [Can be null] Change vector of the document to be patched, used to verify that the document was not changed before the patch reached it. |
| **patch** | `PatchRequest` | Patch request to be performed on the document. |
| **patchIfMissing** | `PatchRequest` | [Can be null] Patch request to be performed if no document with the given ID was found. Will run only if no `changeVector` was passed. |
| **skipPatchIfChangeVectorMismatch** | `bool` | If false and `changeVector` has value, and document with that ID and change vector was not found, will throw an exception. |
| Constructor | Type | Description |
|-------------------------------------|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **id** | `string` | ID of the document to be patched. |
| **changeVector** | `string` | Change vector of the document to be patched.<br>Used to verify that the document was not modified before the patch reached it.<br>Can be `null`. |
| **patch** | `PatchRequest` | Patch request to perform on the document. |
| **patchIfMissing** | `PatchRequest` | Patch request to perform if the specified document is not found.<br>Will run only if no `changeVector` was passed.<br>Can be `null`. |
| **skipPatchIfChangeVectorMismatch** | `bool` | `true` - do not patch if the document has been modified.<br>`false` (Default) - execute the patch even if document has been modified.<br><br>An exception is thrown if:<br>this param is `false` + `changeVector` has value + document with that ID and change vector was not found. |

{INFO/}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,13 +499,13 @@ Learn more about Counters in this [Counters Overview](../../../document-extensio

{CODE:nodejs operations_syntax@client-api\operations\patches\patchRequests.js /}

| Constructor | Type | Description |
|-------------------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| __id__ | `string` | ID of document to be patched. |
| __changeVector__ | `string` | Change vector of the document to be patched.<br>Used to verify that the document was not changed before the patch is executed. Can be null. |
| __patch__ | `PatchRequest` | Patch request to be performed on the document. |
| __patchIfMissing__ | `PatchRequest` | Patch request to be performed if no document with the given ID was found. Will run only if no `changeVector` was passed. Can be null. |
| __skipPatchIfChangeVectorMismatch__ | `boolean` | An exception is thrown if:<br>this param is `false` + `changeVector` has value + document with that ID and change vector was not found. |
| Constructor | Type | Description |
|-------------------------------------|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| __id__ | `string` | ID of the document to be patched. |
| __changeVector__ | `string` | Change vector of the document to be patched.<br>Used to verify that the document was not modified before the patch is executed. Can be null. |
| __patch__ | `PatchRequest` | Patch request to perform on the document. |
| __patchIfMissing__ | `PatchRequest` | Patch request to perform if the specified document is not found.<br>Will run only if no `changeVector` was passed.<br>Can be null. |
| __skipPatchIfChangeVectorMismatch__ | `boolean` | `true` - do not patch if the document has been modified.<br>`false` (Default) - execute the patch even if document has been modified.<br><br>An exception is thrown if:<br>this param is `false` + `changeVector` has value + document with that ID and change vector was not found. |

---

Expand Down
Loading
Loading