Search Results for

    Show / Hide Table of Contents

    Install

    install the nuget package with command:

    Install-Package MongoDB.Entities
    

    Initialize

    first import the package with using MongoDB.Entities;

    then initialize the database connection like so:

    Basic initialization

    await DB.InitAsync("DatabaseName", "HostAddress", PortNumber);
    

    Advanced initialization

    await DB.InitAsync(new MongoClientSettings()
    {
        Server = new MongoServerAddress("localhost", 27017),
        Credential = MongoCredential.CreateCredential("DatabaseName", "username", "password")
    }, 
    "DatabaseName");
    

    Using a connection string

    await DB.InitAsync(MongoClientSettings.FromConnectionString(
          "mongodb+srv://user:password@cluster.mongodb.net/DatabaseName"), 
          "DatabaseName");
    
    In This Article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ / Licensed under MIT / Website generated by DocFX