@@ -387,21 +387,34 @@ How to do it? Well, as operation value, we do not just pass names of array types
387387This way we can pass a property like ` index ` for operations requiring those. To insert this object to multiple arrays, of course we do:
388388
389389``` ts
390- { id : ' 2' , name : ' New book' , __insert : { arrayTypes : [' books' , ' favouriteBooks' ], index : 1 } }
390+ {
391+ id : ' 2' ,
392+ name : ' New book' ,
393+ _insert : { arrayTypes : [' books' , ' favouriteBooks' ], index : 1 },
394+ }
391395```
392396
393397So like before, we can just pass array of array types. Ok, but what, if we need to set different indexes for different array types?
394398
395399``` ts
396- { id : ' 2' , name : ' New book' , __insert : [{ arrayType: ' books' , index: 1 }, { arrayType: ' favouriteBooks' , index: 2 }] }
400+ {
401+ id : ' 2' ,
402+ name : ' New book' ,
403+ __insert : [{ arrayType: ' books' , index: 1 }, { arrayType: ' favouriteBooks' , index: 2 }],
404+ }
397405```
398406
399407As you can see, you just pass array of operation configs, so that each array type can have dedicated properties.
400408
401409And what, if you would like to multiple operations to one node? Easy:
402410
403411``` ts
404- { id : ' 2' , name : ' New book' , __append : ' favouriteBooks' , __insert : { arrayTypes : ' books' , index : 1 } }
412+ {
413+ id : ' 2' ,
414+ name : ' New book' ,
415+ __append : ' favouriteBooks' ,
416+ __insert : { arrayTypes : ' books' , index : 1 },
417+ }
405418```
406419
407420You just add multiple meta operation properties to the same object.
0 commit comments