title: c# Mongo db FindAll()
body: <p>I am new at MongoDB and C#. I don't know how to get all data from my collection "kljenti".</p>
  
  <p>Can anybody help me? </p>
  
  <p>Below is my code </p>
  
  <pre><code> public void getAllData() {
   try {
       string connectionString = "mongodb://172.16.1.24:27017";
       MongoClient client = null;
       client = new MongoClient(connectionString);
       MongoServer server = null;
       server = client.GetServer();
       MongoDatabase database = null;
       database = server.GetDatabase("kljenti");
       var Client = new MongoClient();
       var DB = Client.GetDatabase("knjigoMata");
       var collection = DB.GetCollection&lt;BsonDocument&gt;("kljenti");
       MongoCursor &lt; BsonDocument &gt; cursor = collection.FindAllAs&lt;BsonDocument&gt;();
       } 
  catch{
       MessageBox.Show("Nemogu prikazati podatke o korisnicima");
        }
  </code></pre>