@@ -21,7 +21,7 @@ func main() {
21
21
clientOptions := options .Client ().ApplyURI (uri )
22
22
client , err := mongo .Connect (ctx , clientOptions )
23
23
if err != nil {
24
- log .Fatalf ("failed to connect to the server: %v" , err )
24
+ log .Fatalf ("Failed to connect to the server: %v" , err )
25
25
}
26
26
defer func () { _ = client .Disconnect (ctx ) }()
27
27
@@ -62,7 +62,7 @@ func main() {
62
62
// Creates the index
63
63
searchIndexName , err := coll .SearchIndexes ().CreateOne (ctx , vectorSearchIndexModel )
64
64
if err != nil {
65
- log .Fatalf ("failed to create the vector search index: %v" , err )
65
+ log .Fatalf ("Failed to create the vector search index: %v" , err )
66
66
}
67
67
// end-create-vector-search
68
68
@@ -90,7 +90,7 @@ func main() {
90
90
// Creates the index
91
91
searchIndexName , err := coll .SearchIndexes ().CreateOne (ctx , searchIndexModel )
92
92
if err != nil {
93
- log .Fatalf ("failed to create the atlas search index: %v" , err )
93
+ log .Fatalf ("Failed to create the atlas search index: %v" , err )
94
94
}
95
95
// end-create-atlas-search
96
96
@@ -105,11 +105,11 @@ func main() {
105
105
// Prints the index details to the console as JSON
106
106
var results []bson.M
107
107
if err := cursor .All (ctx , & results ); err != nil {
108
- log .Fatalf ("failed to unmarshal results to bson: %v" , err )
108
+ log .Fatalf ("Failed to unmarshal results to bson: %v" , err )
109
109
}
110
110
res , err := json .Marshal (results )
111
111
if err != nil {
112
- log .Fatalf ("failed to marshal results to json: %v" , err )
112
+ log .Fatalf ("Failed to marshal results to json: %v" , err )
113
113
}
114
114
fmt .Println (res )
115
115
// end-list-index
@@ -138,14 +138,14 @@ func main() {
138
138
// Updates the specified index
139
139
err := coll .SearchIndexes ().UpdateOne (ctx , indexName , definition )
140
140
if err != nil {
141
- log .Fatalf ("failed to update the index: %v" , err )
141
+ log .Fatalf ("Failed to update the index: %v" , err )
142
142
}
143
143
// end-update-index
144
144
145
145
// start-delete-index
146
146
err := coll .SearchIndexes ().DropOne (ctx , "<indexName>" )
147
147
if err != nil {
148
- log .Fatalf ("failed to delete the index: %v" , err )
148
+ log .Fatalf ("Failed to delete the index: %v" , err )
149
149
}
150
150
// end-delete-index
151
151
}
0 commit comments