0
我想做無序批量插入,但我得到寫入錯誤,並在同一單插入工作。服務器IP上的批量寫入操作錯誤:27017。寫錯誤:[[email protected]]
final DBCollection col = db.getCollection(STUDENT);
BulkWriteOperation bulkop = col.initializeUnorderedBulkOperation();
for(){
//putting values in doc
DBObject doc = new BasicDBObject();
//
bulkop.insert(doc);
}
bulkop.execute(WriteConcern.FSYNCED);
這裏是日誌:
Bulk write operation error on server IP:27017. Write errors: [[email protected]].
com.mongodb.BulkWriteException: Bulk write operation error on server 192.168.50.166:27017. Write errors: [[email protected]].
at com.mongodb.BulkWriteHelper.translateBulkWriteException(BulkWriteHelper.java:57)
at com.mongodb.DBCollection.executeBulkWriteOperation(DBCollection.java:2202)
at com.mongodb.DBCollection.executeBulkWriteOperation(DBCollection.java:2188)
at com.mongodb.BulkWriteOperation.execute(BulkWriteOperation.java:121)
我使用蒙戈3.0.4 Java驅動程序。