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 2864476 commit efec545Copy full SHA for efec545
libs/langchain-mongodb/langchain_mongodb/agent_toolkit/database.py
@@ -341,10 +341,15 @@ def _handle_object_id(match: Any) -> str:
341
raise ValueError("ObjectId must contain a value.")
342
return f"ObjectId('{oid_str}')"
343
344
+ def _handle_id_key(match: Any) -> str:
345
+ return f'"{match.group(1)}"'
346
+
347
patterns = [
348
(r'ISODate\(\s*["\']([^"\']*)["\']\s*\)', _handle_iso_date),
349
(r'new\s+Date\(\s*["\']([^"\']*)["\']\s*\)', _handle_new_date),
350
(r'ObjectId\(\s*["\']([^"\']*)["\']\s*\)', _handle_object_id),
351
+ (r'ObjectId\(\s*["\']([^"\']*)["\']\s*\)', _handle_object_id),
352
+ (r'(?<!["\'])\b(_id)\b(?!["\'])', _handle_id_key),
353
]
354
355
for pattern, replacer in patterns:
0 commit comments