We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea823e1 commit 82159a8Copy full SHA for 82159a8
mongodb_client/mongodb-client.go
@@ -48,7 +48,10 @@ func ConnectDb(config *MongodbConfig) {
48
}
49
50
// Create Collections
51
-func CreateCollections(ctx context.Context, dbName string, collectionName string) {
+func CreateCollections(dbName string, collectionName string) {
52
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
53
+ defer cancel()
54
+
55
// List existing collections
56
existingCollections, err := GetDb(dbName).ListCollectionNames(ctx, bson.D{})
57
log.Printf("List of Collections in %s: %v", dbName, existingCollections)
0 commit comments