@@ -16,15 +16,15 @@ await client.flushDb();
16
16
const res1 = await client . json . set ( "bike" , "$" , '"Hyperion"' ) ;
17
17
console . log ( res1 ) ; // OK
18
18
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"']
21
21
22
22
const res3 = await client . json . type ( "bike" , "$" ) ;
23
23
console . log ( res3 ) ; // [ 'string' ]
24
24
// STEP_END
25
25
26
26
// REMOVE_START
27
- assert . equal ( res2 , '"Hyperion"' ) ;
27
+ assert . deepEqual ( res2 , [ '"Hyperion"' ] ) ;
28
28
// REMOVE_END
29
29
30
30
// STEP_START str
@@ -34,12 +34,12 @@ console.log(res4) // [10]
34
34
const res5 = await client . json . strAppend ( "bike" , '" (Enduro bikes)"' ) ;
35
35
console . log ( res5 ) // 27
36
36
37
- const res6 = await client . json . get ( "bike" , "$" ) ;
37
+ const res6 = await client . json . get ( "bike" , { path : "$" } ) ;
38
38
console . log ( res6 ) // ['"Hyperion"" (Enduro bikes)"']
39
39
// STEP_END
40
40
41
41
// REMOVE_START
42
- assert . equal ( res6 , [ '"Hyperion"" (Enduro bikes)"' ] ) ;
42
+ assert . deepEqual ( res6 , [ '"Hyperion"" (Enduro bikes)"' ] ) ;
43
43
// REMOVE_END
44
44
45
45
// STEP_START num
@@ -64,23 +64,23 @@ assert.deepEqual(res10, [1.75])
64
64
const res11 = await client . json . set ( "newbike" , "$" , [ "Deimos" , { "crashes" : 0 } , null ] ) ;
65
65
console . log ( res11 ) ; // OK
66
66
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 ] ]
69
69
70
- const res13 = await client . json . get ( "newbike" , "$[1].crashes" ) ;
70
+ const res13 = await client . json . get ( "newbike" , { path : "$[1].crashes" } ) ;
71
71
console . log ( res13 ) ; // [0]
72
72
73
73
const res14 = await client . json . del ( "newbike" , "$.[-1]" ) ;
74
74
console . log ( res14 ) ; // [1]
75
75
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 } ] ]
78
78
// STEP_END
79
79
80
80
// REMOVE_START
81
- assert . deepEqual ( res15 , [ "Deimos" , {
81
+ assert . deepEqual ( res15 , [ [ "Deimos" , {
82
82
"crashes" : 0
83
- } ] ) ;
83
+ } ] ] ) ;
84
84
// REMOVE_END
85
85
86
86
// STEP_START arr2
@@ -90,20 +90,20 @@ console.log(res16); // OK
90
90
const res17 = await client . json . arrAppend ( "riders" , "$" , "Norem" ) ;
91
91
console . log ( res17 ) ; // [1]
92
92
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' ] ]
95
95
96
96
const res19 = await client . json . arrInsert ( "riders" , "$" , 1 , "Prickett" , "Royse" , "Castilla" ) ;
97
97
console . log ( res19 ) ; // [4]
98
98
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' ] ]
101
101
102
102
const res21 = await client . json . arrTrim ( "riders" , "$" , 1 , 1 ) ;
103
103
console . log ( res21 ) ; // [1]
104
104
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' ] ]
107
107
108
108
const res23 = await client . json . arrPop ( "riders" , "$" ) ;
109
109
console . log ( res23 ) ; // [ 'Prickett' ]
@@ -366,7 +366,7 @@ const res37c = await client.json.set(
366
366
367
367
const res37d = await client . json . get (
368
368
'bikes:inventory' ,
369
- '$.inventory.mountain_bikes[?(@.specs.material =~ @.regex_pat)].model'
369
+ { path : '$.inventory.mountain_bikes[?(@.specs.material =~ @.regex_pat)].model' }
370
370
) ;
371
371
console . log ( res37d ) ; // ['Quaoar', 'Weywot']
372
372
// STEP_END
@@ -398,7 +398,7 @@ const res40a = await client.json.set(
398
398
// Get all prices from the inventory
399
399
const res40b = await client . json . get (
400
400
'bikes:inventory' ,
401
- ' $..price'
401
+ { path : " $..price" }
402
402
) ;
403
403
console . log ( res40b ) ; // [1500, 2072, 3264, 1500, 3941]
404
404
// STEP_END
0 commit comments