Checked other resources
Package (Required)
Related Issues / PRs
Reproduction Steps / Example Code (Python)
from langchain_mongodb.agent_toolkit import MongoDBDatabase, MongoDBDatabaseToolkit
# Connection configuration
MONGO_URI = "mongodb://<USERNAME>:<PASSWORD>@<PROJECT_ID>.us-central1.firestore.goog:443/?loadBalanced=true&tls=true&authMechanism=SCRAM-SHA-256&retryWrites=false"
DB_NAME = "<DATABASE_NAME>"
# Initialize MongoDB database
db = MongoDBDatabase.from_connection_string( MONGO_URI, database=DB_NAME, )
# Initialize toolkit
toolkit = MongoDBDatabaseToolkit( db=db, llm=llm, )
tools = toolkit.get_tools()
Error Message and Stack Trace (if applicable)
pymongo.errors.OperationFailure: authorizedCollections is not supported
full error: {
'ok': 0.0,
'errmsg': 'authorizedCollections is not supported',
'code': 2,
'codeName': 'InvalidArgument'
}
Description
Issue
MongoDB Toolkit fails when used with a Firestore MongoDB-compatible endpoint because the authorizedCollections option is not supported.
Description
When initializing MongoDBDatabase, LangChain internally executes a listCollections command via PyMongo. The MongoDB driver includes the option authorizedCollections=true.
Firestore's MongoDB-compatible endpoint rejects this option and returns the following error:
pymongo.errors.OperationFailure: authorizedCollections is not supported
full error: {
'ok': 0.0,
'errmsg': 'authorizedCollections is not supported',
'code': 2,
'codeName': 'InvalidArgument'
}
Because of this, MongoDBDatabase initialization fails and the MongoDB Toolkit cannot be used with the Firestore MongoDB-compatible endpoint.
Behavior Observed
The MongoDB Toolkit works correctly when connecting to a standard MongoDB instance.
When connecting to a Firestore MongoDB-compatible endpoint, initialization fails due to the unsupported authorizedCollections parameter.
What I Tested
Tested in a local environment -> same error
Deployed in Google Cloud Run -> same error
Since the error occurs in both environments, it appears to be related to compatibility with Firestore’s MongoDB-compatible layer rather than a networking issue.
Expected Behavior
One of the following would help:
- MongoDB Toolkit should gracefully handle MongoDB-compatible endpoints that do not support authorizedCollections, or
- Documentation should clarify that the MongoDB Toolkit only supports full MongoDB deployments.
Additional Context
Firestore provides a MongoDB-compatible API but does not implement the full MongoDB command set. I could not find documentation indicating whether LangChain MongoDB Toolkit supports this compatibility layer.
Environment
- LangChain version: 1.2.15
- langchain-mongodb version: 0.11.0
- PyMongo version: 4.16.0
- Python version: 3.13
Deployment:
Local machine
Google Cloud Run
Database:
Firestore MongoDB-compatible endpoint
System Info
System Information
OS: Linux
OS Version: #106~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 6 08:44:59 UTC
Python Version: 3.10.12 (main, Mar 3 2026, 11:56:32) [GCC 11.4.0]
Checked other resources
Package (Required)
Related Issues / PRs
Reproduction Steps / Example Code (Python)
Error Message and Stack Trace (if applicable)
pymongo.errors.OperationFailure: authorizedCollections is not supported full error: { 'ok': 0.0, 'errmsg': 'authorizedCollections is not supported', 'code': 2, 'codeName': 'InvalidArgument' }Description
Issue
MongoDB Toolkit fails when used with a Firestore MongoDB-compatible endpoint because the authorizedCollections option is not supported.
Description
When initializing MongoDBDatabase, LangChain internally executes a listCollections command via PyMongo. The MongoDB driver includes the option authorizedCollections=true.
Firestore's MongoDB-compatible endpoint rejects this option and returns the following error:
Because of this, MongoDBDatabase initialization fails and the MongoDB Toolkit cannot be used with the Firestore MongoDB-compatible endpoint.
Behavior Observed
The MongoDB Toolkit works correctly when connecting to a standard MongoDB instance.
When connecting to a Firestore MongoDB-compatible endpoint, initialization fails due to the unsupported authorizedCollections parameter.
What I Tested
Tested in a local environment -> same error
Deployed in Google Cloud Run -> same error
Since the error occurs in both environments, it appears to be related to compatibility with Firestore’s MongoDB-compatible layer rather than a networking issue.
Expected Behavior
One of the following would help:
Additional Context
Firestore provides a MongoDB-compatible API but does not implement the full MongoDB command set. I could not find documentation indicating whether LangChain MongoDB Toolkit supports this compatibility layer.
Environment
Deployment:
Local machine
Google Cloud Run
Database:
Firestore MongoDB-compatible endpoint
System Info
System Information