MongoDB磁盘使用情况

时间:2015-01-23 12:36:03

标签: c# mongodb

我一直在使用MongoDB,我注意到它没有关闭Collection.RomveAll操作上的磁盘空间是一个错误或我在我的代码中做错了什么

                var connectionString = "mongodb://localhost";
                var client = new MongoClient(connectionString);
                var server = client.GetServer();
                var database = server.GetDatabase("test");                
                var collection = database.GetCollection("entities");                

                for (int i = 1; i <= 1048576; i++)
                {
                    var entity = new StringEntity { Name = "Name"+i };
                    var entity1 = new ByteEntity { Data = new byte[1024] };

                    collection.Insert(entity);
                    collection.Insert(entity1);                    
                }

                collection.RemoveAll();

0 个答案:

没有答案