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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mongo-entity-orm
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: A MongoDB ORM for Python
5
5
  License: MIT
6
6
  Keywords: mongodb,orm,mongo,async
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "mongo-entity-orm"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "A MongoDB ORM for Python"
9
9
  readme = "README.md"
10
10
  authors = ["Juraj Bezdek <juraj.bezdek@gmail.com>"]
@@ -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), float(v)) for k, v in keys.items())
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), float(v)) for k, v in keys)
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 floats for comparison
54
- target_key = [(str(k), float(v)) for k, v in target_key]
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), float(v)) for k, v in raw_existing_key.items()]
62
+ existing_key = [(str(k), str(v)) for k, v in raw_existing_key.items()]
63
63
  else:
64
- existing_key = [(str(k), float(v)) for k, v in raw_existing_key]
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