Skip to content

Commit b9b20cd

Browse files
committed
fix shoham comments
Signed-off-by: BoazBD <[email protected]>
1 parent 964fee9 commit b9b20cd

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

python/python/glide/async_commands/server_modules/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async def mget(
213213
Retrieves the JSON values at the specified `path` stored at multiple `keys`.
214214
215215
Note:
216-
In cluster mode, if keys in `keyValueMap` map to different hash slots, the command
216+
In cluster mode, if keys in `keys` map to different hash slots, the command
217217
will be split across these slots and executed separately for each. This means the command
218218
is atomic only at the slot level. If one or more slot-specific requests fail, the entire
219219
call will return the first encountered error, even though some requests may have succeeded

python/python/tests/tests_server_modules/test_json.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ async def test_json_mget(self, glide_client: TGlideClient):
178178
await json.set(glide_client, key2, "$", OuterJson.dumps(json2_value)) == OK
179179
)
180180

181+
# Test with root JSONPath
181182
result = await json.mget(
182183
glide_client,
183184
[key1, key2],
@@ -189,6 +190,7 @@ async def test_json_mget(self, glide_client: TGlideClient):
189190
]
190191
assert result == expected_result
191192

193+
# Retrieves the full JSON objects from multiple keys.
192194
result = await json.mget(
193195
glide_client,
194196
[key1, key2],
@@ -208,6 +210,7 @@ async def test_json_mget(self, glide_client: TGlideClient):
208210
expected_result = [b"[1.0]", b"[3.0]"]
209211
assert result == expected_result
210212

213+
# Retrieves the value of the 'b' field for multiple keys.
211214
result = await json.mget(
212215
glide_client,
213216
[key1, key2],
@@ -216,6 +219,7 @@ async def test_json_mget(self, glide_client: TGlideClient):
216219
expected_result = [b'[{"a":1,"b":2.5,"c":true}]', b'[{"a":1,"b":4}]']
217220
assert result == expected_result
218221

222+
# Retrieves all values of 'b' fields using recursive path for multiple keys
219223
result = await json.mget(
220224
glide_client,
221225
[key1, key2],
@@ -224,6 +228,7 @@ async def test_json_mget(self, glide_client: TGlideClient):
224228
expected_result = [b'[{"a":1,"b":2.5,"c":true},2.5]', b'[{"a":1,"b":4},4]']
225229
assert result == expected_result
226230

231+
# retrieves the value of the nested 'b.b' field for multiple keys
227232
result = await json.mget(
228233
glide_client,
229234
[key1, key2],
@@ -232,6 +237,15 @@ async def test_json_mget(self, glide_client: TGlideClient):
232237
expected_result = [b"2.5", b"4"]
233238
assert result == expected_result
234239

240+
# Legacy path that exists in only one of the keys
241+
result = await json.mget(
242+
glide_client,
243+
[key1, key2],
244+
".b.c",
245+
)
246+
expected_result = [b"true", None]
247+
assert result == expected_result
248+
235249
# JSONPath doesn't exist
236250
result = await json.mget(
237251
glide_client,
@@ -249,7 +263,15 @@ async def test_json_mget(self, glide_client: TGlideClient):
249263
)
250264
assert result == [None, None]
251265

252-
# Keys don't exist
266+
# One key doesn't exist
267+
result = await json.mget(
268+
glide_client,
269+
[key1, "{non_existing_key}"],
270+
"$.a",
271+
)
272+
assert result == [b"[1.0]", None]
273+
274+
# Both keys don't exist
253275
result = await json.mget(
254276
glide_client,
255277
["{non_existing_key}1", "{non_existing_key}2"],

0 commit comments

Comments
 (0)