Skip to content

Commit 964fee9

Browse files
BoazBDshohamazon
andauthored
Apply suggestions from code review
Co-authored-by: Shoham Elias <[email protected]> Signed-off-by: BoazBD <[email protected]>
1 parent dd5a0b2 commit 964fee9

File tree

1 file changed

+13
-10
lines changed
  • python/python/glide/async_commands/server_modules

1 file changed

+13
-10
lines changed

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,30 +219,33 @@ async def mget(
219219
call will return the first encountered error, even though some requests may have succeeded
220220
while others did not. If this behavior impacts your application logic, consider splitting
221221
the request into sub-requests per slot to ensure atomicity.
222+
222223
Args:
223-
client (TGlideClient): The Redis client to execute the command.
224+
client (TGlideClient): The client to execute the command.
224225
keys (List[TEncodable]): A list of keys for the JSON documents.
225226
path (Optional[TEncodable]): The path within the JSON documents. Default is root `$`.
226227
227228
Returns:
228229
List[Optional[bytes]]:
230+
List[Optional[bytes]]:
229231
For JSONPath (`path` starts with `$`):
230-
Returns a list of byte representations of the values found at the given path for each key. If the path does not exist,
231-
the entry will be an empty array.
232-
For legacy path (`path` starts with `.`):
233-
Returns a string representation of the value at the specified path. If the path does not exist, the entry will be None.
234-
If a key doesn't exist, the corresponding list element will also be `None`.
232+
Returns a list of byte representations of the values found at the given path for each key.
233+
If `path` does not exist within the key, the entry will be an empty array.
234+
For legacy path (`path` doesn't starts with `$`):
235+
Returns a list of byte representations of the values found at the given path for each key.
236+
If `path` does not exist within the key, the entry will be None.
237+
If a key doesn't exist, the corresponding list element will be None.
235238
236239
237240
Examples:
238-
>>> from glide import json as redisJson
241+
>>> from glide import json as glideJson
239242
>>> import json
240-
>>> json_strs = await redisJson.mget(client, ["doc1", "doc2"], "$")
243+
>>> json_strs = await glideJson.mget(client, ["doc1", "doc2"], "$")
241244
>>> [json.loads(js) for js in json_strs] # Parse JSON strings to Python data
242245
[[{"a": 1.0, "b": 2}], [{"a": 2.0, "b": {"a": 3.0, "b" : 4.0}}]] # JSON objects retrieved from keys `doc1` and `doc2`
243-
>>> await redisJson.mget(client, ["doc1", "doc2"], "$.a")
246+
>>> await glideJson.mget(client, ["doc1", "doc2"], "$.a")
244247
[b"[1.0]", b"[2.0]"] # Returns values at path '$.a' for the JSON documents stored at `doc1` and `doc2`.
245-
>>> await redisJson.mget(client, ["doc1"], "$.non_existing_path")
248+
>>> await glideJson.mget(client, ["doc1"], "$.non_existing_path")
246249
[None] # Returns an empty array since the path '$.non_existing_path' does not exist in the JSON document stored at `doc1`.
247250
"""
248251
args = ["JSON.MGET"] + keys

0 commit comments

Comments
 (0)