How to connect a mongodb bi connector through python? Is pymongo can do it? If yes can please provide some example with the authMechanism PLAIN(LDAP)?
I had try to connect with the pymongo but seems like it does not work for mongodb bi connector as it return error "got responce id xxxxxxxxxx but expected xxxxx".
The code I had tried
from pymongo import MongoClient
# Replace 'localhost' with the hostname or IP address of your BI
Connector server
host = 'localhost'
port = 27017 # Default port for MongoDB
# Connect to the MongoDB BI Connector without specifying username
and password
mongo_uri = f"mongodb://{host}:{port}/"
client = MongoClient(mongo_uri)
# Now you can use the 'client' object to interact with the
MongoDB BI Connector
# For example, you can access databases and collections like
this:
db = client['your_database_name']
collection = db['your_collection_name']
# Perform your operations on the collection here
I had replace the hostname and port with the Mongo db bi connector which works in java but is unable to work, this code does what for the MongoDB.
Is MongoDB and MongoDB bi connector using the same way to connect? Or is there any documentation I can follow? (I didn't find any in pymongo official site)