@@ -16,15 +16,15 @@ await client.flushDb();
1616const res1 = await client . json . set ( "bike" , "$" , '"Hyperion"' ) ;
1717console . log ( res1 ) ; // OK
1818
19- const res2 = await client . json . get ( "bike" , "$" ) ;
20- console . log ( res2 ) ; // "Hyperion"
19+ const res2 = await client . json . get ( "bike" , { path : "$" } ) ;
20+ console . log ( res2 ) ; // [' "Hyperion"']
2121
2222const res3 = await client . json . type ( "bike" , "$" ) ;
2323console . log ( res3 ) ; // [ 'string' ]
2424// STEP_END
2525
2626// REMOVE_START
27- assert . equal ( res2 , '"Hyperion"' ) ;
27+ assert . deepEqual ( res2 , [ '"Hyperion"' ] ) ;
2828// REMOVE_END
2929
3030// STEP_START str
@@ -34,12 +34,12 @@ console.log(res4) // [10]
3434const res5 = await client . json . strAppend ( "bike" , '" (Enduro bikes)"' ) ;
3535console . log ( res5 ) // 27
3636
37- const res6 = await client . json . get ( "bike" , "$" ) ;
37+ const res6 = await client . json . get ( "bike" , { path : "$" } ) ;
3838console . log ( res6 ) // ['"Hyperion"" (Enduro bikes)"']
3939// STEP_END
4040
4141// REMOVE_START
42- assert . equal ( res6 , [ '"Hyperion"" (Enduro bikes)"' ] ) ;
42+ assert . deepEqual ( res6 , [ '"Hyperion"" (Enduro bikes)"' ] ) ;
4343// REMOVE_END
4444
4545// STEP_START num
@@ -64,23 +64,23 @@ assert.deepEqual(res10, [1.75])
6464const res11 = await client . json . set ( "newbike" , "$" , [ "Deimos" , { "crashes" : 0 } , null ] ) ;
6565console . log ( res11 ) ; // OK
6666
67- const res12 = await client . json . get ( "newbike" , "$" ) ;
68- console . log ( res12 ) ; // [ 'Deimos', { crashes: 0 }, null ]
67+ const res12 = await client . json . get ( "newbike" , { path : "$" } ) ;
68+ console . log ( res12 ) ; // [[ 'Deimos', { crashes: 0 }, null ] ]
6969
70- const res13 = await client . json . get ( "newbike" , "$[1].crashes" ) ;
70+ const res13 = await client . json . get ( "newbike" , { path : "$[1].crashes" } ) ;
7171console . log ( res13 ) ; // [0]
7272
7373const res14 = await client . json . del ( "newbike" , "$.[-1]" ) ;
7474console . log ( res14 ) ; // [1]
7575
76- const res15 = await client . json . get ( "newbike" , "$" ) ;
77- console . log ( res15 ) ; // [ 'Deimos', { crashes: 0 } ]
76+ const res15 = await client . json . get ( "newbike" , { path : "$" } ) ;
77+ console . log ( res15 ) ; // [[ 'Deimos', { crashes: 0 } ] ]
7878// STEP_END
7979
8080// REMOVE_START
81- assert . deepEqual ( res15 , [ "Deimos" , {
81+ assert . deepEqual ( res15 , [ [ "Deimos" , {
8282 "crashes" : 0
83- } ] ) ;
83+ } ] ] ) ;
8484// REMOVE_END
8585
8686// STEP_START arr2
@@ -90,20 +90,20 @@ console.log(res16); // OK
9090const res17 = await client . json . arrAppend ( "riders" , "$" , "Norem" ) ;
9191console . log ( res17 ) ; // [1]
9292
93- const res18 = await client . json . get ( "riders" , "$" ) ;
94- console . log ( res18 ) ; // [ 'Norem' ]
93+ const res18 = await client . json . get ( "riders" , { path : "$" } ) ;
94+ console . log ( res18 ) ; // [[ 'Norem' ] ]
9595
9696const res19 = await client . json . arrInsert ( "riders" , "$" , 1 , "Prickett" , "Royse" , "Castilla" ) ;
9797console . log ( res19 ) ; // [4]
9898
99- const res20 = await client . json . get ( "riders" , "$" ) ;
100- console . log ( res20 ) ; // [ 'Norem', 'Prickett', 'Royse', 'Castilla' ]
99+ const res20 = await client . json . get ( "riders" , { path : "$" } ) ;
100+ console . log ( res20 ) ; // [[ 'Norem', 'Prickett', 'Royse', 'Castilla' ] ]
101101
102102const res21 = await client . json . arrTrim ( "riders" , "$" , 1 , 1 ) ;
103103console . log ( res21 ) ; // [1]
104104
105- const res22 = await client . json . get ( "riders" , "$" ) ;
106- console . log ( res22 ) ; // [ 'Prickett' ]
105+ const res22 = await client . json . get ( "riders" , { path : "$" } ) ;
106+ console . log ( res22 ) ; // [[ 'Prickett' ] ]
107107
108108const res23 = await client . json . arrPop ( "riders" , "$" ) ;
109109console . log ( res23 ) ; // [ 'Prickett' ]
@@ -366,7 +366,7 @@ const res37c = await client.json.set(
366366
367367const res37d = await client . json . get (
368368 'bikes:inventory' ,
369- '$.inventory.mountain_bikes[?(@.specs.material =~ @.regex_pat)].model'
369+ { path : '$.inventory.mountain_bikes[?(@.specs.material =~ @.regex_pat)].model' }
370370) ;
371371console . log ( res37d ) ; // ['Quaoar', 'Weywot']
372372// STEP_END
@@ -398,7 +398,7 @@ const res40a = await client.json.set(
398398// Get all prices from the inventory
399399const res40b = await client . json . get (
400400 'bikes:inventory' ,
401- ' $..price'
401+ { path : " $..price" }
402402) ;
403403console . log ( res40b ) ; // [1500, 2072, 3264, 1500, 3941]
404404// STEP_END
0 commit comments