Skip to content

Instantly share code, notes, and snippets.

@AbhinavPradeep
Last active December 20, 2019 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhinavPradeep/4a01f653db71b9335191aab318e1a4f8 to your computer and use it in GitHub Desktop.
Save AbhinavPradeep/4a01f653db71b9335191aab318e1a4f8 to your computer and use it in GitHub Desktop.
Initialize a MongoDb Database
private static IMongoCollection<Person> InitializeDatabase()
{
var client = new MongoClient("mongodb+srv://lol:lol@clusterone-5rfg7.mongodb.net/CustomersDB?retryWrites=true&w=majority");
var database = client.GetDatabase("CustomersDB");
var collection = database.GetCollection<Person>("Customers");
return collection;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment