Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
028bdc8
WIP. Made start on adding .NET support.
LuceCarter Jun 12, 2025
a61b3aa
Fixed devcontainer
dfreniche Jun 12, 2025
0a2539c
Added first 2 dotnet notebooks
LuceCarter Jun 12, 2025
8cf9e90
Fixed devcontainer for dotnet
dfreniche Jun 12, 2025
17e3cc7
Added a working connect database example
dfreniche Jun 16, 2025
4f84768
Merge branch 'main' into add-dotnet
dfreniche Jun 16, 2025
3acf0f5
Merge pull request #11 from mongodb-developer/main
LuceCarter Sep 12, 2025
fc99864
Added 01_connect_database
LuceCarter Sep 12, 2025
4627a82
Added 10_find
LuceCarter Sep 12, 2025
6684862
Added 10_find notebook
LuceCarter Sep 15, 2025
6db2cd2
Merge pull request #15 from mongodb-developer/main
LuceCarter Sep 15, 2025
1d73724
WIP. Made a start on find_arrays
LuceCarter Sep 26, 2025
17b05f2
Added 11_find_arrays
LuceCarter Sep 26, 2025
706d4bd
Added 20_project_sort_limit.ipynb
LuceCarter Sep 26, 2025
0274e2c
Added 30_insert
LuceCarter Sep 30, 2025
c95702c
Added 40_delete
LuceCarter Sep 30, 2025
5657d37
Added 50_update
LuceCarter Sep 30, 2025
3aadcde
Added 60_indexes
LuceCarter Oct 7, 2025
900798a
Added 100_aggregation_pipeline_match
LuceCarter Oct 7, 2025
8cc26a1
Added 101_aggregation_pipeline_arrays
LuceCarter Oct 7, 2025
0641729
Added 102_aggregation_pipeline_unwind
LuceCarter Oct 9, 2025
95917b1
WIP - Adding 103_aggregation_pipeline_lookup
LuceCarter Oct 9, 2025
77a81c5
Added 103_aggregation_pipeline_unwind
LuceCarter Oct 9, 2025
e1c6184
Added 104_aggregation_pipeline_group_by
LuceCarter Oct 9, 2025
8ba9b98
Added 104_aggregation_pipeline_group_by
LuceCarter Oct 9, 2025
296a286
Added 200_full_text_search_create_index
LuceCarter Oct 9, 2025
38b0072
Added 210_full_text_search
LuceCarter Oct 9, 2025
9cbc02a
Updated 200_full_text_search
LuceCarter Oct 9, 2025
6c92986
Neatened up code. Added comments where needed. Removed unneeded comme…
LuceCarter Oct 16, 2025
bf16dac
Merge pull request #17 from mongodb-developer/main
LuceCarter Oct 16, 2025
731ef27
Removed all outputs from previous runs
dfreniche Oct 23, 2025
9d44f87
Added try / catch to avoid exception while deleting a non-existent fu…
dfreniche Oct 23, 2025
4c07be9
Added printing all collections on each database
dfreniche Oct 23, 2025
6c4d5b9
Switched to sync for consistency. Added clarifying comment. Added lim…
LuceCarter Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,31 @@
"installMaven": "true",
"mavenVersion": "3.9.10"
},
"ghcr.io/devcontainers/features/python:1": {}
// https: //github.com/devcontainers/features/tree/main/src/python
"ghcr.io/devcontainers/features/python:1": {
"version": "3.12"
},
"ghcr.io/devcontainers/features/dotnet:2.3.0": {
"version": "9.0",
"installUsingApt": true
}
},
"updateContentCommand": "bash .devcontainer/install-mongodb-db-tools.sh && bash .devcontainer/setup.sh && bash .devcontainer/import.sh",
"postCreateCommand": "",
"postAttachCommand": "",
"postStartCommand": "jupyter trust java/*.ipynb && jupyter trust javascript/*.ipynb && jupyter trust python/*.ipynb && jupyter notebook .",
"postStartCommand": "jupyter trust java/*.ipynb && jupyter trust javascript/*.ipynb && jupyter trust python/*.ipynb && jupyter trust dotnet/*.ipynb && jupyter notebook dotnet/*.ipynb",
"customizations": {
"codespaces": {
"openFiles": [
"README.md"
"dotnet/00_open_mongodb.ipynb"
]
},
"vscode": {
"extensions": [
"ms-toolsai.jupyter",
"mongodb.mongodb-vscode"
"mongodb.mongodb-vscode",
"ms-dotnettools.csharp",
"ms-dotnettools.dotnet-interactive-vscode"
]
}
},
Expand Down
4 changes: 4 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ echo ✅ -----------------------------
sudo apt-get install python3-pymongo -y
sudo apt-get clean packages

# Dotnet Kernel
sudo dotnet tool install -g Microsoft.dotnet-interactive
sudo dotnet interactive jupyter install

echo ✅ Install Deno
echo ✅ ------------
# Install deno - Nodejs modern engine
Expand Down
58 changes: 58 additions & 0 deletions dotnet/00_open_mongodb.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Open MongoDB Using the MongoDB Extension\n",
"\n",
"- click on the MongoDB extension on the side panel\n",
"- add a new connection clicking on `Add Connection`\n",
"- use as connection:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"outputs": [],
"source": [
"mongodb://admin:mongodb@localhost:27017/"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You should see four databases in the MongoDB database server:\n",
"- admin\n",
"- config\n",
"- local\n",
"- library -> we're going to work with this one"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Open the library database\n",
"\n",
"- open the library database\n",
"- open the books collection\n",
"- click on Documents\n",
"- open a document"
]
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
114 changes: 114 additions & 0 deletions dotnet/01_connect_database.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "409549ea",
"metadata": {},
"source": [
"# Install the MongoDB Driver"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d3de619e",
"metadata": {
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"#r \"nuget:MongoDB.Driver\"\n",
"\n",
"using MongoDB.Driver;\n",
"using MongoDB.Bson;"
]
},
{
"cell_type": "markdown",
"id": "22d7c5ea",
"metadata": {},
"source": [
"# Create new client and run a basic command to test connection"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "53fb64de",
"metadata": {
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"string connectionString = \"mongodb://admin:mongodb@localhost:27017/\";\n",
"\n",
"MongoClient client = new MongoClient(connectionString);\n",
"var result = client.GetDatabase(\"admin\").RunCommand<BsonDocument>(new BsonDocument(\"ping\", 1));\n",
"Console.WriteLine(\"MongoDB server version: \" + result.ToJson());\n"
]
},
{
"cell_type": "markdown",
"id": "03c03c08",
"metadata": {},
"source": [
"# List all databases and collections in the cluster"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"language_info": {
"name": "polyglot-notebook"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"var dbs = client.ListDatabaseNames().ToList();\n",
"\n",
"foreach(var db in dbs)\n",
"{\n",
" Console.WriteLine(db);\n",
" var database = client.GetDatabase(db); \n",
" var collectionNames = database.ListCollectionNames().ToList(); \n",
"\n",
" foreach (var collName in collectionNames) \n",
" { \n",
" Console.WriteLine($\" - {collName}\"); \n",
" } \n",
"}"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"language_info": {
"name": "polyglot-notebook"
},
"polyglot_notebook": {
"kernelInfo": {
"defaultKernelName": "csharp",
"items": [
{
"aliases": [],
"name": "csharp"
}
]
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading