Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 6 additions & 7 deletions aspnetcore/tutorials/first-mongo-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ Enable MongoDB and MongoDB Shell access from anywhere on the development machine

1. Download and Install MongoDB Shell:
* macOS/Linux: Choose a directory to extract the MongoDB Shell to. Add the resulting path for `mongosh` to the `PATH` environment variable.
* Windows: MongoDB Shell (mongosh.exe) is installed at *C:\Users\<user>\AppData\Local\Programs\mongosh*. Add the resulting path for `mongosh.exe` to the `PATH` environment variable.
* Windows: MongoDB Shell (mongosh.exe) is installed at *C:\\Users\\\<user>\\AppData\\Local\\Programs\\mongosh*. Add the resulting path for `mongosh.exe` to the `PATH` environment variable.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds extra \ to escape the path backslashes.
This fixes an invalid path in the docs (there should be a backslash between users and ):

image

1. Download and Install MongoDB:
* macOS/Linux: Verify the directory that MongoDB was installed at, usually in */usr/local/mongodb*. Add the resulting path for `mongodb` to the `PATH` environment variable.
* Windows: MongoDB is installed at *C:\\Program Files\MongoDB* by default. Add *C:\\Program Files\\MongoDB\\Server\\\<version_number>\\bin* to the `PATH` environment variable.
* Windows: MongoDB is installed at *C:\\Program Files\\MongoDB* by default. Add *C:\\Program Files\\MongoDB\\Server\\\<version_number>\\bin* to the `PATH` environment variable.
1. Choose a Data Storage Directory: Select a directory on your development machine for storing data. Create the directory if it doesn't exist. The MongoDB Shell doesn't create new directories:
* macOS/Linux: For example, `/usr/local/var/mongodb`.
* Windows: For example, `C:\\BooksData`.
Expand All @@ -65,14 +65,13 @@ Enable MongoDB and MongoDB Shell access from anywhere on the development machine

Use the previously installed MongoDB Shell in the following steps to create a database, make collections, and store documents. For more information on MongoDB Shell commands, see [`mongosh`](https://docs.mongodb.com/mongodb-shell/run-commands/).

1. Open a MongoDB command shell instance by launching `mongosh.exe`.
1. In the command shell, connect to the default test database by running the following command:
1. Open a MongoDB command shell instance by launching `mongosh.exe`, or by running the following command in the command shell:

```console
mongosh
```

1. Run the following command in the command shell:
1. In the command shell connect to the default test database by running:

```console
use BookStore
Expand Down Expand Up @@ -268,7 +267,7 @@ The preceding web API controller:

1. Build and run the app.

1. Navigate to `https://localhost:<port>/api/books`, where `<port>` is the automatically assigned port number for the app, to test the controller's parameterless `Get` action method, select **Try it out** > **Execute**. A JSON response similar to the following is displayed:
1. Navigate to `https://localhost:<port>/api/books`, where `<port>` is the automatically assigned port number for the app, to test the controller's parameterless `Get` action method. A JSON response similar to the following is displayed:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wadepickett in #32353 you explicitly added this text.
Should the docs be updates to include the OpenAPI test pages (e.g. swagger, or maybe using http files)?

I don't think this will add much to the docs, as the testing the api part only verifies retrieving the data.

Copy link
Contributor

@wadepickett wadepickett Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back and forth on this last time we updated since it would add several steps to the tutorial and yet the json returned in the current minimal step is fairly clear and focus of the tutorial is quickly getting ASP.NET Core and MongoDB going. The more I add beyond what is minimally needed for the goal, the more we start to lose people before they get to the last sections beyond testing. For myself, I'm good with longer tutorials. But I follow the data and response too.

That said, you could follow the same Endpoints Explorer .http files for VS and swagger UI for VS Code approach from the [Create a controller-based web API tutorial)[https://review.learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-9.0&branch=pr-en-us-35163&tabs=visual-studio]. I think that would be nice.

Then I will keep a watch on how folks react and where they drop off the topic.


```json
[
Expand Down Expand Up @@ -334,7 +333,7 @@ To satisfy the preceding requirements, make the following changes:

## Additional resources

* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples) ([how to download](xref:index#how-to-download-a-sample))
* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/8.x/BookStoreApi) ([how to download](xref:index#how-to-download-a-sample))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no 9.x version of the docs. If desired I can create them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. If you want to that's great. This topic is on my list of many that need an update. You could update it afterwards in a new PR or this one. Up to you.

* <xref:web-api/index>
* <xref:web-api/action-return-types>
* [Create a web API with ASP.NET Core](/training/modules/build-web-api-aspnet-core/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ To satisfy the preceding requirements, make the following changes:

For more information on building ASP.NET Core web APIs, see the following resources:

* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/3.x/SampleApp) ([how to download](xref:index#how-to-download-a-sample))
* [YouTube version of this article](https://www.youtube.com/watch?v=7uJt_sOenyo&feature=youtu.be)
* <xref:web-api/index>
* <xref:web-api/action-return-types>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ Enable MongoDB and Mongo DB Shell access from anywhere on the development machin

Use the previously installed MongoDB Shell in the following steps to create a database, make collections, and store documents. For more information on MongoDB Shell commands, see [`mongosh`](https://docs.mongodb.com/mongodb-shell/run-commands/).

1. Open a MongoDB command shell instance by launching `mongosh.exe`.
1. In the command shell connect to the default test database by running the following command:
1. Open a MongoDB command shell instance by launching `mongosh.exe`, or by running the following command in the command shell:

```console
mongosh
```

1. Run the following command in the command shell:
1. In the command shell connect to the default test database by running:

```console
use BookStore
Expand Down Expand Up @@ -320,7 +319,7 @@ To satisfy the preceding requirements, make the following changes:

## Additional resources

* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples) ([how to download](xref:index#how-to-download-a-sample))
* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/6.x/BookStoreApi) ([how to download](xref:index#how-to-download-a-sample))
* <xref:web-api/index>
* <xref:web-api/action-return-types>
* [Create a web API with ASP.NET Core](/training/modules/build-web-api-aspnet-core/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ Enable MongoDB and Mongo DB Shell access from anywhere on the development machin

Use the previously installed MongoDB Shell in the following steps to create a database, make collections, and store documents. For more information on MongoDB Shell commands, see [`mongosh`](https://docs.mongodb.com/mongodb-shell/run-commands/).

1. Open a MongoDB command shell instance by launching `mongosh.exe`.
1. In the command shell connect to the default test database by running the following command:
1. Open a MongoDB command shell instance by launching `mongosh.exe`, or by running the following command in the command shell:

```console
mongosh
```

1. Run the following command in the command shell:
1. In the command shell connect to the default test database by running:

```console
use BookStore
Expand Down Expand Up @@ -321,7 +320,7 @@ To satisfy the preceding requirements, make the following changes:

## Additional resources

* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples) ([how to download](xref:index#how-to-download-a-sample))
* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/7.x/BookStoreApi) ([how to download](xref:index#how-to-download-a-sample))
* <xref:web-api/index>
* <xref:web-api/action-return-types>
* [Create a web API with ASP.NET Core](/training/modules/build-web-api-aspnet-core/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ Enable MongoDB and MongoDB Shell access from anywhere on the development machine

1. Download and Install MongoDB Shell:
* macOS/Linux: Choose a directory to extract the MongoDB Shell to. Add the resulting path for `mongosh` to the `PATH` environment variable.
* Windows: MongoDB Shell (mongosh.exe) is installed at *C:\Users\<user>\AppData\Local\Programs\mongosh*. Add the resulting path for `mongosh.exe` to the `PATH` environment variable.
* Windows: MongoDB Shell (mongosh.exe) is installed at *C:\\Users\\\<user>\\AppData\\Local\\Programs\\mongosh*. Add the resulting path for `mongosh.exe` to the `PATH` environment variable.
1. Download and Install MongoDB:
* macOS/Linux: Verify the directory that MongoDB was installed at, usually in */usr/local/mongodb*. Add the resulting path for `mongodb` to the `PATH` environment variable.
* Windows: MongoDB is installed at *C:\\Program Files\MongoDB* by default. Add *C:\\Program Files\\MongoDB\\Server\\\<version_number>\\bin* to the `PATH` environment variable.
* Windows: MongoDB is installed at *C:\\Program Files\\MongoDB* by default. Add *C:\\Program Files\\MongoDB\\Server\\\<version_number>\\bin* to the `PATH` environment variable.
1. Choose a Data Storage Directory: Select a directory on your development machine for storing data. Create the directory if it doesn't exist. The MongoDB Shell doesn't create new directories:
* macOS/Linux: For example, `/usr/local/var/mongodb`.
* Windows: For example, `C:\\BooksData`.
Expand All @@ -52,15 +52,13 @@ Enable MongoDB and MongoDB Shell access from anywhere on the development machine

Use the previously installed MongoDB Shell in the following steps to create a database, make collections, and store documents. For more information on MongoDB Shell commands, see [`mongosh`](https://docs.mongodb.com/mongodb-shell/run-commands/).

1. Open a MongoDB command shell instance by launching `mongosh.exe`.
1. In the command shell, connect to the default test database by running the following command:
1. Open a MongoDB command shell instance by launching `mongosh.exe`, or by running the following command in the command shell:

```console
mongosh
```

1. Run the following command in the command shell:

1. In the command shell connect to the default test database by running:
```console
use BookStore
```
Expand Down Expand Up @@ -262,7 +260,7 @@ The preceding web API controller:

1. Build and run the app.

1. Navigate to `https://localhost:<port>/api/books`, where `<port>` is the automatically assigned port number for the app, to test the controller's parameterless `Get` action method, select **Try it out** > **Execute**. A JSON response similar to the following is displayed:
1. Navigate to `https://localhost:<port>/api/books`, where `<port>` is the automatically assigned port number for the app, to test the controller's parameterless `Get` action method. A JSON response similar to the following is displayed:

```json
[
Expand Down Expand Up @@ -328,7 +326,7 @@ To satisfy the preceding requirements, make the following changes:

## Additional resources

* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples) ([how to download](xref:index#how-to-download-a-sample))
* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/8.x/BookStoreApi) ([how to download](xref:index#how-to-download-a-sample))
* <xref:web-api/index>
* <xref:web-api/action-return-types>
* [Create a web API with ASP.NET Core](/training/modules/build-web-api-aspnet-core/)
Expand Down