現在、Python3(pymongo)を使用して、MongoプロトコルをサポートするAzureドキュメントDBに接続しています。mongodbプロトコルをサポートするazureドキュメントdbのコレクションを表示できません
# 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())
上記のコードスニペットを実行すると、データベースが一覧表示されますが、コレクションは一覧表示されません。これをローカルのmongo dbで実行すると、期待どおりに動作します。
私はもともとデータベース内の既知のコレクションでクエリを実行しようとしていましたが、私はそれもできないようです。私はMongoChefを接続して、期待通りに働いています(querysを実行できる)。
私は間違っていますか?
私の知る限りでは、ドキュメントDB上の現在のバージョンのmongoプロトコルはこれをサポートしていないので、空のリストを返すのです。 – Greener