I have a MongoDB connection string with the DB included. I am currently initializing the collection this way:
var mongoUrl = new MongoUrl(_connectionString);
var mongoClient = new MongoClient(mongoUrl);
var mongoServer = mongoClient.GetServer();
var mongoDatabase = mongoServer.GetDatabase(mongoUrl.DatabaseName);
_defaultCollection = mongoDatabase.GetCollection<Comment>("comments");
This works fine but just seems longer than it should be. Am I missing a less chatty way of doing the same thing?
Thanks Matthew