File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed
test/Ported/Server/Patching Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Added support for the following features:
1010- More like this
1111- [ Suggestions] ( #suggestions )
1212- [ Revisions] ( #revisions )
13+ - [ Advanced patching] ( #advanced-patching )
1314
1415### 4.0.2 - 2018-09-14
1516Added support for the following features:
@@ -736,6 +737,12 @@ const suggestionQueryResult = await session.query({ collection: "users" })
736737// { name: { name: 'name', suggestions: [ 'john' ] } }
737738```
738739
740+ ### Advanced patching
741+ ``` javascript
742+ session .advanced .increment (" users/1" , " age" , 1 );
743+ session .advanced .patch (" users/1" , " underAge" , false );
744+ await session .saveChanges ();
745+ ```
739746
740747## Using object literals for entities
741748
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { pick } from "stream-json/filters/Pick";
1818import { filter } from "stream-json/filters/Filter" ;
1919import { ignore } from "stream-json/filters/Ignore" ;
2020import { parseRestOfOutput } from "../../Mapping/Json/Streams/Pipelines" ;
21+ import { ObjectUtil } from "../../Utility/ObjectUtil" ;
2122
2223export interface Payload {
2324 patch : PatchRequest ;
@@ -128,7 +129,17 @@ export class PatchCommand extends RavenCommand<PatchResult> {
128129
129130 this . _id = id ;
130131 this . _changeVector = changeVector ;
131- this . _patch = conventions . objectMapper . toObjectLiteral ( { patch, patchIfMissing } ) ;
132+ this . _patch = ObjectUtil . transformObjectKeys (
133+ conventions . objectMapper . toObjectLiteral ( { patch, patchIfMissing } ) ,
134+ {
135+ defaultTransform : "pascal" ,
136+ paths : [
137+ {
138+ transform : conventions . remoteEntityFieldNameConvention ,
139+ path : / V a l u e s / i
140+ }
141+ ]
142+ } ) ;
132143 this . _skipPatchIfChangeVectorMismatch = skipPatchIfChangeVectorMismatch ;
133144 this . _returnDebugInformation = returnDebugInformation ;
134145 this . _test = test ;
@@ -154,7 +165,7 @@ export class PatchCommand extends RavenCommand<PatchResult> {
154165 uri += "&test=true" ;
155166 }
156167
157- const body = this . _serializer . serialize ( this . _patch ) ;
168+ const body = JSON . stringify ( this . _patch ) ;
158169 const req = {
159170 method : "PATCH" ,
160171 uri,
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ describe("AdvancedPatchingTest", function () {
2020 afterEach ( async ( ) =>
2121 await disposeTestDocumentStore ( store ) ) ;
2222
23- it . skip ( "can test with variables" , async ( ) => {
23+ it ( "can test with variables" , async ( ) => {
2424
2525 {
2626 const session = store . openSession ( ) ;
You can’t perform that action at this time.
0 commit comments