Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Async with MongoDb

Discussion in 'Connected Games' started by felipeszxbox, Jul 16, 2019.

  1. felipeszxbox

    felipeszxbox

    Joined:
    Jul 15, 2019
    Posts:
    3
    void Start()
    {
    var client = new MongoClient(connectionString);
    var server = client.GetServer();
    var database = server.GetDatabase("Discord");
    var playercollection = database.GetCollection<BsonDocument>("users");
    Debug.Log("Conexao Realizada com Sucesso");

    foreach (var document in playercollection.FindAll())
    {
    Debug.Log("4. SELECT ALL DOCS: \n" + document);
    }
    }`


    Code (CSharp):
    1. void Start()
    2. {
    3.     var client = new MongoClient(connectionString);
    4.     var server = client.GetServer();
    5.     var database = server.GetDatabase("Discord");
    6.     var playercollection = database.GetCollection<BsonDocument>("users");
    7.     Debug.Log("Conexao Realizada com Sucesso");
    8.  
    9.     foreach (var document in playercollection.FindAll())
    10.     {
    11.         Debug.Log("4. SELECT ALL DOCS: \n" + document);
    12.     }
    13. }