force zstd first

This commit is contained in:
yzqzss 2024-05-30 13:01:35 +08:00
parent 1a7719426c
commit 72ee93802d

View File

@ -20,7 +20,8 @@ func connect_to_mongodb() {
fmt.Println("Connecting to MongoDB...")
fmt.Println("MONGODB_URI: len=", len(MONGODB_URI))
serverAPI := options.ServerAPI(options.ServerAPIVersion1)
opts := options.Client().ApplyURI(MONGODB_URI).SetServerAPIOptions(serverAPI).SetAppName("solar-tracker")
opts := options.Client().ApplyURI(MONGODB_URI).SetServerAPIOptions(serverAPI).SetAppName("solar-tracker").SetCompressors([]string{"zstd", "zlib", "snappy"})
fmt.Println("AppName: ", *opts.AppName)
fmt.Println("Compressors: ", opts.Compressors)
client, err := mongo.Connect(context.TODO(), opts)