Skip to content

Commit

Permalink
Rewrite the MongoDB integration article. (#2178)
Browse files Browse the repository at this point in the history
* Rewrite the MongoDB integration article. Fixes #2177

* Fix typo

* Fix xref and links

* Add Atlas

* Address peer feedback
  • Loading branch information
IEvangelist authored Dec 4, 2024
1 parent f61b0d3 commit 1f8790f
Show file tree
Hide file tree
Showing 3 changed files with 240 additions and 63 deletions.
4 changes: 2 additions & 2 deletions docs/database/includes/postgresql-app-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ To add an init bind mount to the PostgreSQL server resource, call the <xref:Aspi
var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddPostgres("postgres")
.WithInitBindMount(source: @"C:\PostgreSQL\Init");
.WithInitBindMount(@"C:\PostgreSQL\Init");

var postgresdb = postgres.AddDatabase("postgresdb");

Expand All @@ -146,7 +146,7 @@ var exampleProject = builder.AddProject<Projects.ExampleProject>()
// After adding all resources, run the app...
```

The init bind mount relies on the host machine's filesystem to initialize the PostgreSQL server database with the containers _init_ folder. This folder is used for initialization, running any executable shell scripts or _.sql_ command files after the _postgres-data_ folder is created. The init bind mount is mounted at the `C:\PostgreSQL\Data` on Windows (or `/PostgreSQL/Data` on Unix) path on the host machine in the PostgreSQL server container.
The init bind mount relies on the host machine's filesystem to initialize the PostgreSQL server database with the containers _init_ folder. This folder is used for initialization, running any executable shell scripts or _.sql_ command files after the _postgres-data_ folder is created. The init bind mount is mounted at the `C:\PostgreSQL\Init` on Windows (or `/PostgreSQL/Init` on Unix) path on the host machine in the PostgreSQL server container.

### Add PostgreSQL server resource with parameters

Expand Down
14 changes: 9 additions & 5 deletions docs/database/includes/sql-app-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-pac

### Add SQL Server resource and database resource

In your app host project, call <xref:Aspire.Hosting.SqlServerBuilderExtensions.AddSqlServer*> to add and return a SQL Server resource builder. Chain a call to the returned resource build to <xref:Aspire.Hosting.SqlServerBuilderExtensions.AddDatabase*>, to add SQL Server database resource.
In your app host project, call <xref:Aspire.Hosting.SqlServerBuilderExtensions.AddSqlServer*> to add and return a SQL Server resource builder. Chain a call to the returned resource builder to <xref:Aspire.Hosting.SqlServerBuilderExtensions.AddDatabase*>, to add SQL Server database resource.

```csharp
var builder = DistributedApplication.CreateBuilder(args);
Expand All @@ -34,7 +34,8 @@ var sql = builder.AddSqlServer("sql")
var db = sql.AddDatabase("database");

builder.AddProject<Projects.ExampleProject>()
.WithReference(db);
.WithReference(db)
.WaitFor(db);

// After adding all resources, run the app...
```
Expand Down Expand Up @@ -72,7 +73,8 @@ var sql = builder.AddSqlServer("sql")
var db = sql.AddDatabase("database");

builder.AddProject<Projects.ExampleProject>()
.WithReference(db);
.WithReference(db)
.WaitFor(db);

// After adding all resources, run the app...
```
Expand All @@ -95,7 +97,8 @@ var sql = builder.AddSqlServer("sql")
var db = sql.AddDatabase("database");

builder.AddProject<Projects.ExampleProject>()
.WithReference(db);
.WithReference(db)
.WaitFor(db);

// After adding all resources, run the app...
```
Expand All @@ -117,7 +120,8 @@ var sql = builder.AddSqlServer("sql", password);
var db = sql.AddDatabase("database");

builder.AddProject<Projects.ExampleProject>()
.WithReference(db);
.WithReference(db)
.WaitFor(db);

// After adding all resources, run the app...
```
Expand Down
Loading

0 comments on commit 1f8790f

Please sign in to comment.