You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`"2024-01-15T12:00:00Z"` (string) |`"2024-01-15T12:00:00+00:00"`| Z converted to +00:00 |
71
+
|`1705312800` (UNIX timestamp) |`"2024-01-15T10:00:00+00:00"`| Timestamps are inherently UTC |
72
+
73
+
**SDK Type Reconstruction:** When you retrieve a `Document` via the Python SDK, datetime/date/decimal values in `metadata` are automatically reconstructed to their Python types using the `metadata_types` hints. This means you get back what you put in:
**Morphik handles mixed formats correctly** - filtering and comparisons work even if some documents have naive datetimes and others have timezone-aware ones:
90
+
91
+
```python
92
+
from datetime import datetime, UTC
93
+
94
+
# Mixed formats across documents - Morphik handles this fine
results = db.list_documents(filters={"ts": {"$gte": "2024-05-01"}}) # Returns Doc B
100
+
```
101
+
102
+
<Warning>
103
+
**Python comparisons fail with mixed formats.** If you retrieve mixed-format datetimes and compare them locally, Python raises `TypeError`:
104
+
105
+
```python
106
+
sorted([naive_dt, aware_dt]) # TypeError: can't compare offset-naive and offset-aware
107
+
```
108
+
109
+
**Recommendation:** Stay consistent - pick one format (preferably timezone-aware with UTC) and use it throughout. Let Morphik handle filtering rather than sorting in Python.
110
+
</Warning>
111
+
62
112
## Implicit vs Explicit Syntax
63
113
64
114
-**Implicit equality** – Bare key/value pairs (`{"status": "active"}`) use JSON containment and are ideal for simple matching. They also check whether an array contains the value.
0 commit comments