我想向MongoDB添加1,000,000个文档。 我运行这个虚拟代码,
Mongo mongo = null;
mongo = new Mongo("localhost", 27017);
DB db = mongo.getDB("MyTestDB");
System.out.println("Connection was established....");
DBCollection col = db.getCollection("ThirdCollection");
for (int i = 0; i < 100000; i++) {
BasicDBObject doc = new BasicDBObject("name", "MongoDB "+i)
.append("type", "database")
.append("count", 1)
.append("info",
new BasicDBObject("x", 203).append("y", 102));
col.insert(doc);
}
我看到它只插入99,637个文件。
我是MongoDB的新手,也许是优化问题还是别的什么?
由于