Skip to content

Commit d0e4675

Browse files
Merge pull request #34529 from timdeschryver/issue/34317
update MongoDB controller based API tutorial to v9
2 parents 6aa1bba + 2981ee7 commit d0e4675

File tree

2 files changed

+347
-20
lines changed

2 files changed

+347
-20
lines changed

aspnetcore/tutorials/first-mongo-app.md

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ uid: tutorials/first-mongo-app
1515

1616
By [Pratik Khandelwal](https://twitter.com/K2Prk) and [Scott Addie](https://twitter.com/Scott_Addie)
1717

18-
:::moniker range=">= aspnetcore-8.0"
18+
:::moniker range=">= aspnetcore-9.0"
1919

2020
This tutorial creates a web API that runs Create, Read, Update, and Delete (CRUD) operations on a [MongoDB](https://www.mongodb.com/what-is-mongodb) NoSQL database.
2121

@@ -35,15 +35,11 @@ In this tutorial, you learn how to:
3535

3636
# [Visual Studio](#tab/visual-studio)
3737

38-
[!INCLUDE[](~/includes/net-prereqs-vs-8.0.md)]
38+
[!INCLUDE[](~/includes/net-prereqs-vs-9.0.md)]
3939

4040
# [Visual Studio Code](#tab/visual-studio-code)
4141

42-
[!INCLUDE[](~/includes/net-prereqs-vsc-8.0.md)]
43-
44-
# [Visual Studio for Mac](#tab/visual-studio-mac)
45-
46-
[!INCLUDE[](~/includes/net-prereqs-mac-8.0.md)]
42+
[!INCLUDE[](~/includes/net-prereqs-vsc-9.0.md)]
4743

4844
---
4945

@@ -151,7 +147,11 @@ Use the previously installed MongoDB Shell in the following steps to create a da
151147
1. Go to **File** > **New** > **Project**.
152148
1. Select the **ASP.NET Core Web API** project type, and select **Next**.
153149
1. Name the project *BookStoreApi*, and select **Next**.
154-
1. Select the **.NET 8.0 (Long Term support)** framework and select **Create**.
150+
1. In the **Additional information** dialog:
151+
* Confirm the **Framework** is **.NET 9.0 (Standard Term Support)**.
152+
* Confirm the checkbox for **Use controllers** is checked.
153+
* Confirm the checkbox for **Enable OpenAPI support** is checked.
154+
* Select **Create**.
155155
1. In the **Package Manager Console** window, navigate to the project root. Run the following command to install the .NET driver for MongoDB:
156156

157157
```powershell
@@ -163,7 +163,7 @@ Use the previously installed MongoDB Shell in the following steps to create a da
163163
1. Run the following commands in a command shell:
164164

165165
```dotnetcli
166-
dotnet new webapi -o BookStoreApi
166+
dotnet new webapi -o BookStoreApi --use-controllers
167167
code BookStoreApi
168168
```
169169

@@ -176,17 +176,6 @@ Use the previously installed MongoDB Shell in the following steps to create a da
176176
dotnet add package MongoDB.Driver
177177
```
178178

179-
# [Visual Studio for Mac](#tab/visual-studio-mac)
180-
181-
1. Select **File** > **New Project...**.
182-
1. Select **Web and Console** > **App** from the sidebar.
183-
1. Select the **ASP.NET Core** > **API** C# project template, and select **Next**.
184-
1. Select **.NET 8.0** from the **Target Framework** drop-down list, and select **Next**.
185-
1. Enter *BookStoreApi* for the **Project Name**, and select **Create**.
186-
1. In the **Solution** pad, right-click the project's **Dependencies** node and select **Manage NuGet Packages**.
187-
1. Enter *MongoDB.Driver* in the search box, select the *MongoDB.Driver* package, and select **Add Package**.
188-
1. Select the **Accept** button in the **License Acceptance** dialog.
189-
190179
---
191180

192181
## Add an entity model
@@ -352,6 +341,8 @@ To satisfy the preceding requirements, make the following changes:
352341

353342
:::moniker-end
354343

344+
[!INCLUDE[](~/tutorials/first-mongo-app/includes/first-mongo-app8.md)]
345+
355346
[!INCLUDE[](~/tutorials/first-mongo-app/includes/first-mongo-app7.md)]
356347

357348
[!INCLUDE[](~/tutorials/first-mongo-app/includes/first-mongo-app6.md)]

0 commit comments

Comments
 (0)