Two connections to the same DB possible?

To open and close the DB connection in the requests is simple, but with scheduled tasks its more complex. Thats why I want to access the DB with two different connections. One is for requests and the other is for scheduled tasks.

How can I achieve something like this? Are two connectionStrings with different values required?

  static const String username = Env.username;
  static const String secretKey = Env.secretKey;
  static const String mongoUrl = Env.mongoUrl;
  static const String port = Env.port;
  static const String dbName = 'MyDatabase';
  static const String connectionString = 'mongodb://$username:$secretKey@$mongoUrl:$port/$dbName/';

  // for requests
  static final db = Db(connectionString);

 // for scheduled tasks
  static final db2 = Db(connectionString);

Not sure which language this is, but generally you create a MongodbClient instance to interact with mongodb, and internally it uses a connection pool. You can of course create as many client instances as you like.

This is done automatically, not manually by application code.