From f628274f3b89a96711f3d04c056018ceb97cb2e0 Mon Sep 17 00:00:00 2001 From: Lindsey Moore Date: Fri, 11 Jul 2025 16:19:45 -0400 Subject: [PATCH 1/4] DOCSP-51826 Connection Str as Env Var --- source/connect/mongoclient.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/connect/mongoclient.txt b/source/connect/mongoclient.txt index 61a880fe..c6193037 100644 --- a/source/connect/mongoclient.txt +++ b/source/connect/mongoclient.txt @@ -87,6 +87,30 @@ A standard connection string includes the following components: For more information about creating a connection string, see :manual:`Connection Strings ` in the MongoDB Server documentation. +.. _golang-usage-examples-env-variable: + +Store Your Connection String as an Environment Variable +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can access your connection string as an environment variable +by using the following code: + +.. code-block:: go + + uri := os.Getenv("MONGODB_URI") + +You can use `GoDotEnv `__ to define +your environment variable. + +Add the following application configuration in your ``.env`` file at the +root of your project, replacing the placeholders with the values for your +deployment's connection string. To learn more, see the +`GoDotEnv documentation `__. + +.. code-block:: + + MONGODB_URI=mongodb+srv://:@?retryWrites=true&w=majority + Create a Client to Connect to MongoDB Atlas ------------------------------------------- From 3c6d81e90ae3e3da3e6c83c8aea68a70d94e4591 Mon Sep 17 00:00:00 2001 From: Lindsey Moore Date: Fri, 11 Jul 2025 16:29:13 -0400 Subject: [PATCH 2/4] edit urls and change section titleto be shorter for url reasons --- source/connect/mongoclient.txt | 4 ++-- .../includes/fundamentals/code-snippets/CRUD/changeStream.go | 2 +- .../fundamentals/code-snippets/CRUD/compoundOperations.go | 2 +- source/includes/fundamentals/code-snippets/CRUD/delete.go | 2 +- source/includes/fundamentals/code-snippets/CRUD/limit.go | 2 +- source/includes/fundamentals/code-snippets/CRUD/retrieve.go | 2 +- .../fundamentals/code-snippets/CRUD/retryableReadsWrites.go | 2 +- source/includes/fundamentals/code-snippets/CRUD/runCommand.go | 2 +- source/includes/fundamentals/code-snippets/CRUD/skip.go | 2 +- source/includes/fundamentals/code-snippets/CRUD/sort.go | 2 +- source/includes/fundamentals/code-snippets/logging.go | 2 +- source/includes/usage-examples/code-snippets/bulk.go | 2 +- source/includes/usage-examples/code-snippets/command.go | 2 +- source/includes/usage-examples/code-snippets/count.go | 2 +- source/includes/usage-examples/code-snippets/deleteMany.go | 2 +- source/includes/usage-examples/code-snippets/deleteOne.go | 2 +- source/includes/usage-examples/code-snippets/distinct.go | 2 +- source/includes/usage-examples/code-snippets/find.go | 2 +- source/includes/usage-examples/code-snippets/findOne.go | 2 +- source/includes/usage-examples/code-snippets/insertMany.go | 2 +- source/includes/usage-examples/code-snippets/insertOne.go | 2 +- source/includes/usage-examples/code-snippets/replace.go | 2 +- source/includes/usage-examples/code-snippets/struct-tag.go | 2 +- source/includes/usage-examples/code-snippets/updateMany.go | 2 +- source/includes/usage-examples/code-snippets/updateOne.go | 2 +- source/includes/usage-examples/code-snippets/watch.go | 2 +- 26 files changed, 27 insertions(+), 27 deletions(-) diff --git a/source/connect/mongoclient.txt b/source/connect/mongoclient.txt index c6193037..b2434e12 100644 --- a/source/connect/mongoclient.txt +++ b/source/connect/mongoclient.txt @@ -89,8 +89,8 @@ Strings ` in the MongoDB Server documentation. .. _golang-usage-examples-env-variable: -Store Your Connection String as an Environment Variable -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Environment Variable +~~~~~~~~~~~~~~~~~~~~ You can access your connection string as an environment variable by using the following code: diff --git a/source/includes/fundamentals/code-snippets/CRUD/changeStream.go b/source/includes/fundamentals/code-snippets/CRUD/changeStream.go index d8a4043f..8a333a93 100644 --- a/source/includes/fundamentals/code-snippets/CRUD/changeStream.go +++ b/source/includes/fundamentals/code-snippets/CRUD/changeStream.go @@ -23,7 +23,7 @@ type Course struct { func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/fundamentals/code-snippets/CRUD/compoundOperations.go b/source/includes/fundamentals/code-snippets/CRUD/compoundOperations.go index a2fe6cca..2b334e5d 100644 --- a/source/includes/fundamentals/code-snippets/CRUD/compoundOperations.go +++ b/source/includes/fundamentals/code-snippets/CRUD/compoundOperations.go @@ -23,7 +23,7 @@ type Course struct { func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/fundamentals/code-snippets/CRUD/delete.go b/source/includes/fundamentals/code-snippets/CRUD/delete.go index 482793d7..803310ce 100644 --- a/source/includes/fundamentals/code-snippets/CRUD/delete.go +++ b/source/includes/fundamentals/code-snippets/CRUD/delete.go @@ -24,7 +24,7 @@ type Book struct { func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/fundamentals/code-snippets/CRUD/limit.go b/source/includes/fundamentals/code-snippets/CRUD/limit.go index fd0a078d..6fad89fb 100644 --- a/source/includes/fundamentals/code-snippets/CRUD/limit.go +++ b/source/includes/fundamentals/code-snippets/CRUD/limit.go @@ -23,7 +23,7 @@ type Course struct { func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/fundamentals/code-snippets/CRUD/retrieve.go b/source/includes/fundamentals/code-snippets/CRUD/retrieve.go index 1001e735..f83c7ebf 100644 --- a/source/includes/fundamentals/code-snippets/CRUD/retrieve.go +++ b/source/includes/fundamentals/code-snippets/CRUD/retrieve.go @@ -25,7 +25,7 @@ type Tea struct { func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/fundamentals/code-snippets/CRUD/retryableReadsWrites.go b/source/includes/fundamentals/code-snippets/CRUD/retryableReadsWrites.go index 29baf8e6..95c6827e 100644 --- a/source/includes/fundamentals/code-snippets/CRUD/retryableReadsWrites.go +++ b/source/includes/fundamentals/code-snippets/CRUD/retryableReadsWrites.go @@ -12,7 +12,7 @@ import ( func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } // start-retryable-example diff --git a/source/includes/fundamentals/code-snippets/CRUD/runCommand.go b/source/includes/fundamentals/code-snippets/CRUD/runCommand.go index 87e7b2f4..6dcdc41d 100644 --- a/source/includes/fundamentals/code-snippets/CRUD/runCommand.go +++ b/source/includes/fundamentals/code-snippets/CRUD/runCommand.go @@ -17,7 +17,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/fundamentals/code-snippets/CRUD/skip.go b/source/includes/fundamentals/code-snippets/CRUD/skip.go index 42c8b4ac..0760598c 100644 --- a/source/includes/fundamentals/code-snippets/CRUD/skip.go +++ b/source/includes/fundamentals/code-snippets/CRUD/skip.go @@ -24,7 +24,7 @@ type Course struct { func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/fundamentals/code-snippets/CRUD/sort.go b/source/includes/fundamentals/code-snippets/CRUD/sort.go index a56808cb..733ef1d7 100644 --- a/source/includes/fundamentals/code-snippets/CRUD/sort.go +++ b/source/includes/fundamentals/code-snippets/CRUD/sort.go @@ -24,7 +24,7 @@ type Course struct { func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/fundamentals/code-snippets/logging.go b/source/includes/fundamentals/code-snippets/logging.go index 8d1a1be6..4b252850 100644 --- a/source/includes/fundamentals/code-snippets/logging.go +++ b/source/includes/fundamentals/code-snippets/logging.go @@ -24,7 +24,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } //standardLogging(uri) //customLogging(uri) diff --git a/source/includes/usage-examples/code-snippets/bulk.go b/source/includes/usage-examples/code-snippets/bulk.go index 21a67a7e..3ae26c9f 100644 --- a/source/includes/usage-examples/code-snippets/bulk.go +++ b/source/includes/usage-examples/code-snippets/bulk.go @@ -32,7 +32,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/command.go b/source/includes/usage-examples/code-snippets/command.go index 67f0bd0e..85803a86 100644 --- a/source/includes/usage-examples/code-snippets/command.go +++ b/source/includes/usage-examples/code-snippets/command.go @@ -21,7 +21,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/count.go b/source/includes/usage-examples/code-snippets/count.go index 068d862b..b2a81fdf 100644 --- a/source/includes/usage-examples/code-snippets/count.go +++ b/source/includes/usage-examples/code-snippets/count.go @@ -20,7 +20,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/deleteMany.go b/source/includes/usage-examples/code-snippets/deleteMany.go index b208e54f..0bcc60a3 100644 --- a/source/includes/usage-examples/code-snippets/deleteMany.go +++ b/source/includes/usage-examples/code-snippets/deleteMany.go @@ -20,7 +20,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/deleteOne.go b/source/includes/usage-examples/code-snippets/deleteOne.go index 9362c7cb..8d23b987 100644 --- a/source/includes/usage-examples/code-snippets/deleteOne.go +++ b/source/includes/usage-examples/code-snippets/deleteOne.go @@ -20,7 +20,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/distinct.go b/source/includes/usage-examples/code-snippets/distinct.go index b8a18bbb..f3f0a6af 100644 --- a/source/includes/usage-examples/code-snippets/distinct.go +++ b/source/includes/usage-examples/code-snippets/distinct.go @@ -20,7 +20,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/find.go b/source/includes/usage-examples/code-snippets/find.go index af0bf4e3..a70573c8 100644 --- a/source/includes/usage-examples/code-snippets/find.go +++ b/source/includes/usage-examples/code-snippets/find.go @@ -34,7 +34,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/findOne.go b/source/includes/usage-examples/code-snippets/findOne.go index 31f66530..e3ba4447 100644 --- a/source/includes/usage-examples/code-snippets/findOne.go +++ b/source/includes/usage-examples/code-snippets/findOne.go @@ -34,7 +34,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/insertMany.go b/source/includes/usage-examples/code-snippets/insertMany.go index 13750c3f..577dab73 100644 --- a/source/includes/usage-examples/code-snippets/insertMany.go +++ b/source/includes/usage-examples/code-snippets/insertMany.go @@ -31,7 +31,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/insertOne.go b/source/includes/usage-examples/code-snippets/insertOne.go index fc2b5c7d..41493f85 100644 --- a/source/includes/usage-examples/code-snippets/insertOne.go +++ b/source/includes/usage-examples/code-snippets/insertOne.go @@ -31,7 +31,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/replace.go b/source/includes/usage-examples/code-snippets/replace.go index d2e1aeb9..84328efe 100644 --- a/source/includes/usage-examples/code-snippets/replace.go +++ b/source/includes/usage-examples/code-snippets/replace.go @@ -32,7 +32,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/struct-tag.go b/source/includes/usage-examples/code-snippets/struct-tag.go index ea6f5bd8..b5d55dd1 100644 --- a/source/includes/usage-examples/code-snippets/struct-tag.go +++ b/source/includes/usage-examples/code-snippets/struct-tag.go @@ -34,7 +34,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/updateMany.go b/source/includes/usage-examples/code-snippets/updateMany.go index 7e8578a7..fdf4d235 100644 --- a/source/includes/usage-examples/code-snippets/updateMany.go +++ b/source/includes/usage-examples/code-snippets/updateMany.go @@ -20,7 +20,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/updateOne.go b/source/includes/usage-examples/code-snippets/updateOne.go index 825cd1a6..5e84e294 100644 --- a/source/includes/usage-examples/code-snippets/updateOne.go +++ b/source/includes/usage-examples/code-snippets/updateOne.go @@ -20,7 +20,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) diff --git a/source/includes/usage-examples/code-snippets/watch.go b/source/includes/usage-examples/code-snippets/watch.go index bb81b8f0..9fa2ec03 100644 --- a/source/includes/usage-examples/code-snippets/watch.go +++ b/source/includes/usage-examples/code-snippets/watch.go @@ -21,7 +21,7 @@ func main() { var uri string if uri = os.Getenv("MONGODB_URI"); uri == "" { - log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable") + log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable") } client, err := mongo.Connect(options.Client().ApplyURI(uri)) From 89d27e60c900b6b19e84b5ace05fbfb066a74ce2 Mon Sep 17 00:00:00 2001 From: Lindsey Moore Date: Fri, 11 Jul 2025 17:15:59 -0400 Subject: [PATCH 3/4] DOCSP-51826 Check release note refs --- .../fundamentals/crud/write-read-pref.txt | 2 -- .../fundamentals/enterprise-auth.txt | 4 ---- .../fundamentals/monitoring.txt | 1 - source/reference/release-notes.txt | 10 ++++------ 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/source/archive-reference-files/fundamentals/crud/write-read-pref.txt b/source/archive-reference-files/fundamentals/crud/write-read-pref.txt index 91742fd3..3f3f2bf7 100644 --- a/source/archive-reference-files/fundamentals/crud/write-read-pref.txt +++ b/source/archive-reference-files/fundamentals/crud/write-read-pref.txt @@ -37,8 +37,6 @@ the following levels: In the following sections, you can learn how to customize the consistency and availability of the data in your replica sets. -.. _golang-writeconcern: - Write Concern ------------- diff --git a/source/archive-reference-files/fundamentals/enterprise-auth.txt b/source/archive-reference-files/fundamentals/enterprise-auth.txt index cd539b55..68529c1a 100644 --- a/source/archive-reference-files/fundamentals/enterprise-auth.txt +++ b/source/archive-reference-files/fundamentals/enterprise-auth.txt @@ -198,8 +198,6 @@ address of your MongoDB server: authenticates using the PLAIN Simple Authentication and Security Layer (SASL) defined in `RFC-4616 `__. -.. _golang-mongodb-oidc: - MONGODB-OIDC ------------ @@ -479,8 +477,6 @@ callback function that you defined: :end-before: end-credential-callback :emphasize-lines: 6 -.. _golang-kubernetes-oidc: - Kubernetes ~~~~~~~~~~ diff --git a/source/archive-reference-files/fundamentals/monitoring.txt b/source/archive-reference-files/fundamentals/monitoring.txt index 0b47891d..c67c5e3c 100644 --- a/source/archive-reference-files/fundamentals/monitoring.txt +++ b/source/archive-reference-files/fundamentals/monitoring.txt @@ -1,4 +1,3 @@ -.. _golang-monitoring: ========== Monitoring diff --git a/source/reference/release-notes.txt b/source/reference/release-notes.txt index 12e7188b..13b225db 100644 --- a/source/reference/release-notes.txt +++ b/source/reference/release-notes.txt @@ -130,9 +130,8 @@ in the {+driver-short+} source code on GitHub. This release includes the following improvements and fixes: -- Support for OpenID Connect (OIDC) authentication. To learn more, see - the :ref:`golang-mongodb-oidc` section of the Enterprise - Authentication Mechanisms guide. +- Documentation support for OpenID Connect (OIDC) authentication. To learn more, see + the :ref:`golang-mongodb-oidc` guide. - You can access the GridFS API from the ``mongo`` package. In previous versions, you could access GridFS functions from the separate ``gridfs`` @@ -219,8 +218,7 @@ The 1.17 {+driver-short+} release includes the following improvements and fixes: - Adds support for OpenID Connect (OIDC) authentication. To learn more, see - the :ref:`golang-mongodb-oidc` section of the Enterprise - Authentication Mechanisms guide. + the :ref:`golang-mongodb-oidc` guide. - Adds support for Queryable Encryption (QE) range queries. To use this feature, your app must connect to {+mdb-server+} 8.0 or later. For @@ -376,7 +374,7 @@ Logging Interface You can now record connection management and command execution events by using the ``LogSink`` logging interface. -To learn more, see the :ref:`golang-logging` Fundamentals guide. +To learn more, see the :ref:`golang-logging` guide. Additional BSON Marshalling Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 4d750aab29751b56997158e1f1621c1b09f33886 Mon Sep 17 00:00:00 2001 From: Lindsey Moore Date: Fri, 11 Jul 2025 17:18:56 -0400 Subject: [PATCH 4/4] Revert "DOCSP-51826 Check release note refs" This reverts commit 89d27e60c900b6b19e84b5ace05fbfb066a74ce2. --- .../fundamentals/crud/write-read-pref.txt | 2 ++ .../fundamentals/enterprise-auth.txt | 4 ++++ .../fundamentals/monitoring.txt | 1 + source/reference/release-notes.txt | 10 ++++++---- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/source/archive-reference-files/fundamentals/crud/write-read-pref.txt b/source/archive-reference-files/fundamentals/crud/write-read-pref.txt index 3f3f2bf7..91742fd3 100644 --- a/source/archive-reference-files/fundamentals/crud/write-read-pref.txt +++ b/source/archive-reference-files/fundamentals/crud/write-read-pref.txt @@ -37,6 +37,8 @@ the following levels: In the following sections, you can learn how to customize the consistency and availability of the data in your replica sets. +.. _golang-writeconcern: + Write Concern ------------- diff --git a/source/archive-reference-files/fundamentals/enterprise-auth.txt b/source/archive-reference-files/fundamentals/enterprise-auth.txt index 68529c1a..cd539b55 100644 --- a/source/archive-reference-files/fundamentals/enterprise-auth.txt +++ b/source/archive-reference-files/fundamentals/enterprise-auth.txt @@ -198,6 +198,8 @@ address of your MongoDB server: authenticates using the PLAIN Simple Authentication and Security Layer (SASL) defined in `RFC-4616 `__. +.. _golang-mongodb-oidc: + MONGODB-OIDC ------------ @@ -477,6 +479,8 @@ callback function that you defined: :end-before: end-credential-callback :emphasize-lines: 6 +.. _golang-kubernetes-oidc: + Kubernetes ~~~~~~~~~~ diff --git a/source/archive-reference-files/fundamentals/monitoring.txt b/source/archive-reference-files/fundamentals/monitoring.txt index c67c5e3c..0b47891d 100644 --- a/source/archive-reference-files/fundamentals/monitoring.txt +++ b/source/archive-reference-files/fundamentals/monitoring.txt @@ -1,3 +1,4 @@ +.. _golang-monitoring: ========== Monitoring diff --git a/source/reference/release-notes.txt b/source/reference/release-notes.txt index 13b225db..12e7188b 100644 --- a/source/reference/release-notes.txt +++ b/source/reference/release-notes.txt @@ -130,8 +130,9 @@ in the {+driver-short+} source code on GitHub. This release includes the following improvements and fixes: -- Documentation support for OpenID Connect (OIDC) authentication. To learn more, see - the :ref:`golang-mongodb-oidc` guide. +- Support for OpenID Connect (OIDC) authentication. To learn more, see + the :ref:`golang-mongodb-oidc` section of the Enterprise + Authentication Mechanisms guide. - You can access the GridFS API from the ``mongo`` package. In previous versions, you could access GridFS functions from the separate ``gridfs`` @@ -218,7 +219,8 @@ The 1.17 {+driver-short+} release includes the following improvements and fixes: - Adds support for OpenID Connect (OIDC) authentication. To learn more, see - the :ref:`golang-mongodb-oidc` guide. + the :ref:`golang-mongodb-oidc` section of the Enterprise + Authentication Mechanisms guide. - Adds support for Queryable Encryption (QE) range queries. To use this feature, your app must connect to {+mdb-server+} 8.0 or later. For @@ -374,7 +376,7 @@ Logging Interface You can now record connection management and command execution events by using the ``LogSink`` logging interface. -To learn more, see the :ref:`golang-logging` guide. +To learn more, see the :ref:`golang-logging` Fundamentals guide. Additional BSON Marshalling Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~