Skip to content

Timeout error doing db.list_collection_names() in CosmosDB-MongoDB-vCore_AzureOpenAI_Tutorial.ipynb #37

@francesco-bellei

Description

@francesco-bellei

Hi, I'm trying the tutorial notebook for CosmosDB-MongoDB-vCore.
I have no problems connecting with:

mongo_conn = "mongodb+srv://"+urllib.parse.quote(COSMOS_MONGO_USER)+":"+urllib.parse.quote(COSMOS_MONGO_PWD)+"@"+COSMOS_MONGO_SERVER+"?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000"
mongo_client = pymongo.MongoClient(mongo_conn)

But then when creating the the DB and listing collection names with:

db = mongo_client['ExampleDB']
COLLECTION_NAME = "ExampleCollection"
collection = db[COLLECTION_NAME]
if COLLECTION_NAME not in db.list_collection_names():
    db.create_collection(COLLECTION_NAME)

the call of:

db.list_collection_names()

doesn't go through and return the error:

ServerSelectionTimeoutError: c.cosmos-db-openai-explore.mongocluster.cosmos.azure.com:10260: timed out (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms), Timeout: 30s, Topology Description: <TopologyDescription id: 6602e5685fa5c332a820d706, topology_type: Unknown, servers: [<ServerDescription ('c.cosmos-db-openai-explore.mongocluster.cosmos.azure.com', 10260) server_type: Unknown, rtt: None, error=NetworkTimeout('c.cosmos-db-openai-explore.mongocluster.cosmos.azure.com:10260: timed out (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)')>]>

Any advice? Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions