hello everyone ๐ noob here
how come i get this error message from the mongodb driver's Connect() function
i have this code:
// this Println() works fine
fmt.Println(os.Getenv(MONGO_URI_ENV_VAR))
client, err := mongo.Connect( // this is where it's erroring out
context.TODO(),
options.Client().ApplyURI(os.Getenv(MONGO_URI_ENV_VAR)),
)
if err != nil {
log.Fatalf("mongo.Connect(): %s\n", err)
}
and i get the printline of the api key from the env var fine
but the mongo.Connect() function errors out saying:
2023/07/22 21:47:25 mongo.Connect(): error parsing uri: scheme must be "mongodb" or "mongodb+srv"
the url looks something like this btw:
"mongodb+srv://<username>:<password>@<project-name>.mongodb.net/?retryWrites=true&w=majority"