Skip to content

Commit 39ae078

Browse files
committed
moved uri declaration
1 parent 00bf6a2 commit 39ae078

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/code-snippets/updateMany.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"go.mongodb.org/mongo-driver/mongo/options"
1010
)
1111

12-
func main() {
13-
// Replace the uri string with your MongoDB deployment's connection string.
14-
uri := "mongodb+srv://<username>:<password>@<cluster-address>/test?w=majority"
12+
// Replace the uri string with your MongoDB deployment's connection string.
13+
const uri = "mongodb+srv://<username>:<password>@<cluster-address>/test?w=majority"
1514

15+
func main() {
1616
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri))
1717

1818
if err != nil {
@@ -36,6 +36,6 @@ func main() {
3636
panic(err)
3737
}
3838

39-
fmt.Printf("%v documents were updated.\n", result.ModifiedCount)
39+
fmt.Printf("Documents updated: %v\n", result.ModifiedCount)
4040

4141
}

0 commit comments

Comments
 (0)