Skip to content

prmeyn/UmbracoMongoDbClient

Repository files navigation

Setup procedure

The appsettings.json file should be given a connection string to your MongoDB databases

{
	"MongoDbCredentials": {
	    "CertificateFilePathWithName": "<optional Certificate file path with name [pfx file]>",
	    "CertificatePassword": "<optional Certificate password>",
	    "ConnectionString": "<mandatory> mongodb+srv://cluster0.fyu.mongodb.net/?authSource=%24external&authMechanism=MONGODB-X509&retryWrites=true&w=majority"
	  }
}

Sample code

var database = MongoDBClientConnection.GetDatabase("YouDatabaseName");
var collection = database.GetCollection<T>("YourCollectionName"); // of type T

For more examples on how to Insert, Modify your data, check the MongoDB official documentation: https://www.mongodb.com/docs/drivers/csharp/current/quick-reference/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages