mirror of
https://github.com/kataras/iris.git
synced 2025-03-13 21:36:28 +01:00
update mongodb official driver tutorial to its latest API (requires an options.ClientOptions instead of a simple url to connect to the server/host
Former-commit-id: 86ad73198016ce9d4b8c89ddb7191e932f759628
This commit is contained in:
parent
137c41344d
commit
2725267aa4
|
@ -20,6 +20,7 @@ import (
|
|||
"github.com/kataras/iris"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
const version = "0.0.1"
|
||||
|
@ -35,7 +36,8 @@ func init() {
|
|||
}
|
||||
|
||||
func main() {
|
||||
client, err := mongo.Connect(context.Background(), env.DSN)
|
||||
clientOptions := options.Client().SetHosts([]string{env.DSN})
|
||||
client, err := mongo.Connect(context.Background(), clientOptions)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user