mongoDb property

Db get mongoDb

Gets the MongoDB database instance. If the database is not connected, this method will attempt to connect to MongoDB. Throws an exception if the database is not running.

Implementation

mongo.Db get mongoDb {
  if (_mongoDb == null) {
    connectMongoDb().then((value) => _mongoDb = value);
    throw ('Error DB is not running');
  }

  return _mongoDb!;
}