Skip to content

Commit 82159a8

Browse files
author
Amit
committed
Removed context parameter from Create Collections Function.
1 parent ea823e1 commit 82159a8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mongodb_client/mongodb-client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ func ConnectDb(config *MongodbConfig) {
4848
}
4949

5050
// Create Collections
51-
func CreateCollections(ctx context.Context, dbName string, collectionName string) {
51+
func CreateCollections(dbName string, collectionName string) {
52+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
53+
defer cancel()
54+
5255
// List existing collections
5356
existingCollections, err := GetDb(dbName).ListCollectionNames(ctx, bson.D{})
5457
log.Printf("List of Collections in %s: %v", dbName, existingCollections)

0 commit comments

Comments
 (0)