Skip to content

Commit 4c07be9

Browse files
committed
Added printing all collections on each database
1 parent 9d44f87 commit 4c07be9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

dotnet/01_connect_database.ipynb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"id": "03c03c08",
5757
"metadata": {},
5858
"source": [
59-
"# List all databases in the cluster"
59+
"# List all databases and collections in the cluster"
6060
]
6161
},
6262
{
@@ -77,6 +77,13 @@
7777
"foreach(var db in dbs)\n",
7878
"{\n",
7979
" Console.WriteLine(db);\n",
80+
" var database = client.GetDatabase(db); \n",
81+
" var collectionNames = database.ListCollectionNames().ToList(); \n",
82+
"\n",
83+
" foreach (var collName in collectionNames) \n",
84+
" { \n",
85+
" Console.WriteLine($\" - {collName}\"); \n",
86+
" } \n",
8087
"}"
8188
]
8289
}

0 commit comments

Comments
 (0)