Q: Can I use MongoDB 3.6 or later with Unity 2018.4? I'm trying to apply the MongoDB with this unity tutorial MongoDB bought mLab, so the signing into mongoDB is done via mongoDB atlas. And they only support MongoDB 3.6 and later.
I've created a cluster with AWS (similarly to the GUI mLab has),


*

*On "Overview" tab hit the "CONNECT" button. Out of the three options: "Connect with the Mongo Shell" / "Connect Your Application" / "Connect with MongoDB Compass" - Connect Your Application looked the most relevant to the code you've provided.

*In: "Connect Your Application" you need to choose a driver: I chose C# / .NET (because this is a C# project), version 2.5 or later.

*Got "Connection string": mongodb+srv://user_name:<password>@testmp-pkump.mongodb.net/test?retryWrites=true
Few things:


*

*The project name is not "test" (as it says here, right before the retryWrites = true): mongodb+srv://:@testmp-pkump.mongodb.net/test?retryWrites=true

*I've passed this link to the code under: private const string MONGO_URI , and for user name I write the user I've added to the cluster, and for the password, I write the password I've added to the user in the cluster. - and not the user I've used to create the MongoDB account

*Running the "Server" scene resolves with an error: =
ArgumentException: Invalid keyword 'mongodb+srv://:@serverclientmp-
1oqao.gcp.mongodb.net/test?retrywrites'.
MongoDB.Driver.MongoConnectionStringBuilder.set_Item (System.String 
keyword, System.Object value)
System.Data.Common.DbConnectionStringBuilder.ParseConnectionStringNonOdbc 
(System.String connectionString) 
System.Data.Common.DbConnectionStringBuilder.ParseConnectionString 
(System.String connectionString) 
System.Data.Common.DbConnectionStringBuilder.set_ConnectionString 
(System.String value) MongoDB.Driver.MongoConnectionStringBuilder..ctor 
(System.String connectionString) 
MongoDB.Driver.MongoClient.ParseConnectionString (System.String 
connectionString) MongoDB.Driver.MongoClient..ctor (System.String 
connectionString) Mongo.Init () (at Assets/Scripts/Database/Mongo.cs:16) 
Server.Init () (at Assets/Scripts/Server.cs:40) Server.Start () (at 
Assets/Scripts/Server.cs:28)

I've tried to change the API Compatibility Level to .NET 4.x and the following error came:
ArgumentException: Invalid option 'retryWrites'.
Parameter name: url
MongoDB.Driver.MongoUrlBuilder.Parse (System.String url) (at 
<6da29fc855c44d33ad78b3e27475ff27>:0)
MongoDB.Driver.MongoUrlBuilder..ctor (System.String url) (at 
<6da29fc855c44d33ad78b3e27475ff27>:0)
MongoDB.Driver.MongoUrl..ctor (System.String url) (at 
<6da29fc855c44d33ad78b3e27475ff27>:0)
MongoDB.Driver.MongoClient.ParseConnectionString (System.String 
connectionString) (at <6da29fc855c44d33ad78b3e27475ff27>:0)
MongoDB.Driver.MongoClient..ctor (System.String connectionString) (at 
<6da29fc855c44d33ad78b3e27475ff27>:0)
Mongo.Init () (at Assets/Script/Database/Mongo.cs:15)
Server.Init () (at Assets/Script/Server.cs:38)
Server.Start () (at Assets/Script/Server.cs:27)

I would like to know what I need to add to my scripts to make it work or if this tutorial is outdated and a new approach needs to be done.
Thanks

A: I know I am 8 months too late but, I have recently began working with MongoDB in Unity and I don't know if this will help but the short answer is I'm not sure. But I managed to connect to my remote and local db, so I'll explain how I did it below.

The Long answer:
I did not watch the tutorial video you followed but i setup my connections with these dll files (I am assuming you also created a Plugins folder for them). As for the "tutorial", I simply followed this quick start guide and this one. Everything else API related I just read the documentation.

*

*I'm using MongoDB v4.2.1

*I'm using Unity 2019.3

*I'm using API compatibility .Net Standard 2.0

*I'm using the admin user on the cluster. I don't know what your case is but I remember the documentation says that your user should have read and write privileges, so check that maybe.

Finally, I had an error when I first tried to connect to the remote DB, but maybe because I have my code wrapped around a try catch block, it didn't produce the error you provided but rather this:
Unable to authenticate using sasl protocol mechanism SCRAM-SHA-1 mongo c# driver

Which occurred because I forgot to take the angle brackets out of the code and had this instead - <password> - yes I left my password wrapped around the brackets, rookie mistake lol.

Here's how I connected to my Atlas cluster:
private const string remoteDB = "mongodb+srv://user_name:<password>@mycluster.mongodb.net/test?retryWrites=true";
static MongoClient newClient = new MongoClient(remoteDB);

internal Database()//This is a constructor, I'm not using MonoBehaviour
{
    db = newClient.GetDatabase(DATABASE_NAME);
    lbCollection = db.GetCollection<BsonDocument>(lbColl);
    gameStateCollection = db.GetCollection<BsonDocument>(gameStateColl);
}

internal static async Task TestConnection()
{
    try
    {
        await GetDBNames();
    }
    catch (Exception e)
    {
        Debug.Log("<color=red> Error</color> found while testing db connection:");
        Debug.Log(e.Message);
    }
}

private static async Task<List<string>> GetDBNames()
{
    List<string> dbNames = new List<string>();

    var dbs = await newClient.ListDatabaseNamesAsync();
    dbNames = dbs.ToList();

    if (dbNames.Count > 0)
    {
        Debug.Log($"Databases in {nameof(dbNames)}: ");

        for (int i = 0; i < dbNames.Count; i++)
        {
            Debug.Log($"{dbNames[i]}");
        }
        
        return dbNames;
    }

    Debug.Log($"<color=red>{nameof(GetDBNames)}</color> Returning null. No Dbs found.");
    return null;
}

