File tree Expand file tree Collapse file tree
java-spring/src/main/java/com/mongodb/samplemflix/config
python-fastapi/src/database Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ protected void configureClientSettings(MongoClientSettings.Builder builder) {
6363
6464 // Apply connection string and custom settings
6565 builder .applyConnectionString (connectionString )
66+ // Set application name
67+ .applicationName ("sample-app-java-mflix" )
6668 // Configure connection pool for optimal performance
6769 .applyToConnectionPoolSettings (poolBuilder ->
6870 poolBuilder .maxSize (100 ) // Maximum connections in pool
Original file line number Diff line number Diff line change @@ -29,7 +29,10 @@ async function _connectToDatabase(): Promise<Db> {
2929
3030 try {
3131 // Create new MongoDB client instance
32- client = new MongoClient ( uri ) ;
32+ client = new MongoClient ( uri , {
33+ // Set application name
34+ appName : "sample-app-node-mflix" ,
35+ } ) ;
3336
3437 // Connect to MongoDB
3538 await client . connect ( ) ;
Original file line number Diff line number Diff line change 55
66load_dotenv ()
77
8- client = AsyncMongoClient (os .getenv ("MONGO_URI" ))
8+ client = AsyncMongoClient (os .getenv ("MONGO_URI" ),
9+ # Set application name
10+ appname = "sample-app-python-mflix" )
11+
912db = client [os .getenv ("MONGO_DB" )]
1013
1114voyage_api_key = os .getenv ("VOYAGE_API_KEY" )
You can’t perform that action at this time.
0 commit comments