mongo-entity-orm 0.1.3__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mongo_entity_orm-0.1.3 → mongo_entity_orm-0.1.4}/PKG-INFO +1 -1
- {mongo_entity_orm-0.1.3 → mongo_entity_orm-0.1.4}/pyproject.toml +1 -1
- {mongo_entity_orm-0.1.3 → mongo_entity_orm-0.1.4}/src/mongo_orm/utils.py +8 -8
- {mongo_entity_orm-0.1.3 → mongo_entity_orm-0.1.4}/LICENSE +0 -0
- {mongo_entity_orm-0.1.3 → mongo_entity_orm-0.1.4}/README.md +0 -0
- {mongo_entity_orm-0.1.3 → mongo_entity_orm-0.1.4}/src/mongo_orm/__init__.py +0 -0
- {mongo_entity_orm-0.1.3 → mongo_entity_orm-0.1.4}/src/mongo_orm/core.py +0 -0
|
@@ -17,11 +17,11 @@ def _get_index_hash(collection_name: str, spec: "IndexSpec") -> str:
|
|
|
17
17
|
# Normalize keys to a stable tuple representation
|
|
18
18
|
if isinstance(keys, dict):
|
|
19
19
|
# Keep order as provided in dict
|
|
20
|
-
norm_keys = tuple((str(k),
|
|
20
|
+
norm_keys = tuple((str(k), str(v)) for k, v in keys.items())
|
|
21
21
|
elif isinstance(keys, list):
|
|
22
|
-
norm_keys = tuple((str(k),
|
|
22
|
+
norm_keys = tuple((str(k), str(v)) for k, v in keys)
|
|
23
23
|
else:
|
|
24
|
-
norm_keys = ((str(keys), 1.0),)
|
|
24
|
+
norm_keys = ((str(keys), "1.0"),)
|
|
25
25
|
|
|
26
26
|
# Create a stable representation of the spec including important options
|
|
27
27
|
relevant_parts = {
|
|
@@ -48,10 +48,10 @@ def index_exists(collection: Collection, spec: "IndexSpec") -> bool:
|
|
|
48
48
|
elif isinstance(keys, list):
|
|
49
49
|
target_key = keys
|
|
50
50
|
else:
|
|
51
|
-
target_key = [(keys, 1)]
|
|
51
|
+
target_key = [(keys, "1.0")]
|
|
52
52
|
|
|
53
|
-
# Normalize values to
|
|
54
|
-
target_key = [(str(k),
|
|
53
|
+
# Normalize values to strings for comparison
|
|
54
|
+
target_key = [(str(k), str(v)) for k, v in target_key]
|
|
55
55
|
|
|
56
56
|
existing_indexes = collection.index_information()
|
|
57
57
|
|
|
@@ -59,9 +59,9 @@ def index_exists(collection: Collection, spec: "IndexSpec") -> bool:
|
|
|
59
59
|
# info['key'] can be a list of tuples or a SON/dict object
|
|
60
60
|
raw_existing_key = info["key"]
|
|
61
61
|
if hasattr(raw_existing_key, "items"):
|
|
62
|
-
existing_key = [(str(k),
|
|
62
|
+
existing_key = [(str(k), str(v)) for k, v in raw_existing_key.items()]
|
|
63
63
|
else:
|
|
64
|
-
existing_key = [(str(k),
|
|
64
|
+
existing_key = [(str(k), str(v)) for k, v in raw_existing_key]
|
|
65
65
|
|
|
66
66
|
if existing_key == target_key:
|
|
67
67
|
return True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|