Last active
December 20, 2019 03:03
-
-
Save AbhinavPradeep/4a01f653db71b9335191aab318e1a4f8 to your computer and use it in GitHub Desktop.
Initialize a MongoDb Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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