summaryrefslogtreecommitdiff
path: root/redis/commands/json/commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/commands/json/commands.py')
-rw-r--r--redis/commands/json/commands.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/redis/commands/json/commands.py b/redis/commands/json/commands.py
index 7fd4039..c02c47a 100644
--- a/redis/commands/json/commands.py
+++ b/redis/commands/json/commands.py
@@ -31,8 +31,8 @@ class JSONCommands:
name: str,
path: str,
scalar: int,
- start: Optional[int] = 0,
- stop: Optional[int] = -1,
+ start: Optional[int] = None,
+ stop: Optional[int] = None,
) -> List[Union[int, None]]:
"""
Return the index of ``scalar`` in the JSON array under ``path`` at key
@@ -43,9 +43,13 @@ class JSONCommands:
For more information see `JSON.ARRINDEX <https://redis.io/commands/json.arrindex>`_.
""" # noqa
- return self.execute_command(
- "JSON.ARRINDEX", name, str(path), self._encode(scalar), start, stop
- )
+ pieces = [name, str(path), self._encode(scalar)]
+ if start is not None:
+ pieces.append(start)
+ if stop is not None:
+ pieces.append(stop)
+
+ return self.execute_command("JSON.ARRINDEX", *pieces)
def arrinsert(
self, name: str, path: str, index: int, *args: List[JsonType]