I am currently using Python3 (pymongo) to connect to an Azure Document DB with Mongo protocol support.
# reference to connection string
self.connection_string = "mongodb://<user>:<pw>@<location>:<port>/<database>?ssl=true"
# creates the connection (this is working)
self.mongo_client = MongoClient( self.connection_string )
# show databases and there collections
print(self.mongo_client.database_names())
for db_name in self.mongo_client.database_names():
print(db_name,">",self.mongo_client[db_name].collection_names())
Running the above snippet of code lists the databases however the collections are not listed. Running this on a local mongo db works as expected.
I was originally trying to run a query on a known collection within the database however, I can't even seem to be able to do that. I have MongoChef connected and is working as expected (able to run querys).
Any ideas what I could be doing wrong?
