I am using the package:
I am trying to use the following as specified in the documentation:
mongoContext, _ := context.WithTimeout(context.Background(), 10*time.Second) mongoClient, _ := mongo.Connect(mongoContext, "mongodb://localhost:27017")
However on the second line I get the error:
cannot use "mongodb://localhost:27017" (type string) as type *options.ClientOptions in argument to mongo.Connect
It seems the documentation doesn't match the implementation. Has anyone been successful?
The documentation states:
//To do this in a single step, you can use the Connect function: ctx, _ := context.WithTimeout(context.Background(), 10*time.Second) client, err := mongo.Connect(ctx, "mongodb://localhost:27017")