Ismail Hakki Sen

Ismail Hakki Sen

  • NA
  • 146
  • 8.4k

MongoDB is too low with select operations in c#!

Jan 15 2015 7:10 AM
I'm working on finishing project and I'm testing some database management systems. For example i insert 1 million record on sql server, oracle, mongo db etc.


But mongo db select performance is too low. With insert and delete mongo db is fastest.


This is my code how i listing the collections.


using MongoDB.Driver;
using MongoDB.Bson;

and my class

MongoServer server = MongoServer.Create(    );
 DateTime startTime = DateTime.Now;
            label21.Text = "Baslangiç:                    " + startTime;
            
            var database = server.GetDatabase("testdb1");
            var collection = database.GetCollection<kayitlar>("tablo1");

            foreach (var deger in collection.FindAll())
            {
                string[] row1 = new string[] { deger.deger1.ToString() };
                dataGridView1.Rows.Add(row1);
                Application.DoEvents();
            }

            label22.Text = "Durum:                         " + Convert.ToString(dataGridView1.Rows.Count - 1) + " adet veri listelendi";

            DateTime endTime = DateTime.Now;
            label20.Text = "Bitis:                             " + endTime;

            TimeSpan span = endTime.Subtract(startTime);
            label19.Text = "Geçen süre:                 " + span.Duration().ToString();
            int saniye = span.Seconds;
            if (saniye < 1) saniye = 1;
            label18.Text = "Kayit okuma / sn:         " + Convert.ToString(Convert.ToInt64(txt_adet.Text) / saniye);


do you know better version to listing collections?