We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f602a7d commit eca10aeCopy full SHA for eca10ae
django_mongodb_backend/fields/json.py
@@ -24,7 +24,12 @@ def build_json_mql_path(lhs, key_transforms):
24
get_field = {"$getField": {"input": result, "field": key}}
25
# Handle array indexing if the key is a digit. If key is something
26
# like '001', it's not an array index despite isdigit() returning True.
27
- if key.isdigit() and str(int(key)) == key:
+ try:
28
+ int(key)
29
+ is_digit = str(int(key)) == key
30
+ except ValueError:
31
+ is_digit = False
32
+ if is_digit:
33
result = {
34
"$cond": {
35
"if": {"$isArray": result},
0 commit comments