Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libs/langchain-mongodb/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

---

## Changes in version 0.8.0 (2025/11/18)

- Update dependencies to align with LangChain 1.0, which is now the minimum supported version of LangChain.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should call out that we depend on langchain_classic now, since it is a heavy dependency that might not be obvious why it ended up in a user's environment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should call out that we depend on langchain_classic now, since it is a heavy dependency that might not be obvious why it ended up in a user's environment.

These same dependencies (or close to) already exist in langchain < 1.0. What I would mention is that. "Note: langchain_mongodb 0.8.0 depends on langchain_classic, so still has the heavy dependency set than langchain did before the v1 refactor."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the updated wording sufficient?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you call out langchain-classic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest commit does.

This includes adding `langchain_classic` as a dependency to support existing Retriever APIs.

## Changes in version 0.7.2 (2025/10/30)

- Pin LangChain version to < 1.0 to avoid compatibility issues while in pre-1.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,15 @@ def _handle_object_id(match: Any) -> str:
raise ValueError("ObjectId must contain a value.")
return f"ObjectId('{oid_str}')"

def _handle_id_key(match: Any) -> str:
return f'"{match.group(1)}"'

patterns = [
(r'ISODate\(\s*["\']([^"\']*)["\']\s*\)', _handle_iso_date),
(r'new\s+Date\(\s*["\']([^"\']*)["\']\s*\)', _handle_new_date),
(r'ObjectId\(\s*["\']([^"\']*)["\']\s*\)', _handle_object_id),
(r'ObjectId\(\s*["\']([^"\']*)["\']\s*\)', _handle_object_id),
(r'(?<!["\'])\b(_id)\b(?!["\'])', _handle_id_key),
]

for pattern, replacer in patterns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
from typing import Any, List, Optional

import pymongo
from langchain.retrievers.parent_document_retriever import ParentDocumentRetriever
from langchain_classic.retrievers.parent_document_retriever import (
ParentDocumentRetriever,
)
from langchain_core.callbacks import (
AsyncCallbackManagerForRetrieverRun,
CallbackManagerForRetrieverRun,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from typing import Any, Dict, Sequence, Tuple, Union

from langchain.chains.query_constructor.schema import AttributeInfo
from langchain.retrievers.self_query.base import SelfQueryRetriever
from langchain_classic.chains.query_constructor.schema import (
AttributeInfo,
)
from langchain_classic.retrievers.self_query.base import (
SelfQueryRetriever,
)
from langchain_core.language_models import BaseLanguageModel
from langchain_core.runnables import Runnable
from langchain_core.structured_query import (
Expand Down
23 changes: 12 additions & 11 deletions libs/langchain-mongodb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ description = "An integration package connecting MongoDB and LangChain"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"langchain-core>=0.3,<1.0",
"langchain>=0.3,<1.0",
"langchain-core>=1.0",
"langchain>=1.0",
"langchain-classic>=1.0",
"pymongo>=4.6.1",
"langchain-text-splitters>=0.3,<1.0",
"langchain-text-splitters>=1.0",
"numpy>=1.26",
"lark<2.0.0,>=1.1.9",
]

[dependency-groups]
dev = [
"freezegun>=1.2.2",
"langchain>=0.3.14,<1.0",
"langchain-core>=0.3.29,<1.0",
"langchain-text-splitters>=0.3.5,<1.0",
"langchain>=1.0",
"langchain-core>=1.0",
"langchain-text-splitters>=1.0",
"pytest-mock>=3.10.0",
"pytest>=7.3.0",
"syrupy>=4.0.2",
Expand All @@ -33,13 +34,13 @@ dev = [
"pre-commit>=4.0",
"mypy>=1.10",
"simsimd>=6.5.0",
"langchain-ollama>=0.2.2,<1.0",
"langchain-openai>=0.2.14,<1.0",
"langchain-community>=0.3.27,<1.0",
"langchain-ollama>=1.0",
"langchain-openai>=1.0",
"langchain-community>=0.3.27",
"pypdf>=5.0.1",
"langgraph>=0.2.72",
"langgraph>=1.0.0",
"flaky>=3.8.1",
"langchain-tests==0.3.22,<1.0",
"langchain-tests==0.3.22",
"pip>=25.0.1",
"typing-extensions>=4.12.2",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pytest
import requests
from flaky import flaky # type:ignore[import-untyped]
from langchain.agents import create_agent # type: ignore[assignment]
from langchain_openai import AzureChatOpenAI, ChatOpenAI
from langgraph.prebuilt import create_react_agent
from pymongo import MongoClient

from langchain_mongodb.agent_toolkit import (
Expand Down Expand Up @@ -64,7 +64,7 @@ def test_toolkit_response(db):
prompt = MONGODB_AGENT_SYSTEM_PROMPT.format(top_k=5)

test_query = "Which country's customers spent the most?"
agent = create_react_agent(llm, toolkit.get_tools(), prompt=prompt)
agent = create_agent(llm, toolkit.get_tools(), system_prompt=prompt)
agent.step_timeout = 60
events = agent.stream(
{"messages": [("user", test_query)]},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import json
import warnings

from langchain.memory import ConversationBufferMemory # type: ignore[import-not-found]
from langchain_classic.memory import (
ConversationBufferMemory,
)
from langchain_core.messages import message_to_dict

from langchain_mongodb.chat_message_histories import MongoDBChatMessageHistory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
from typing import Generator, Sequence, Union

import pytest
from langchain.chains.query_constructor.schema import AttributeInfo
from langchain.retrievers.self_query.base import SelfQueryRetriever
from langchain_classic.chains.query_constructor.schema import (
AttributeInfo,
)
from langchain_classic.retrievers.self_query.base import (
SelfQueryRetriever,
)
from langchain_core.documents import Document
from langchain_openai import AzureChatOpenAI, ChatOpenAI
from langchain_openai.chat_models.base import BaseChatOpenAI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

import mongomock
import pytest
from langchain.memory import ConversationBufferMemory # type: ignore[import-not-found]
from langchain_classic.memory import (
ConversationBufferMemory,
)
from langchain_core.messages import message_to_dict
from pytest_mock import MockerFixture

Expand Down
Loading
Loading