我正在使用mongo java驱动程序并执行collection.insert()。 例外情况如下:
com.mongodb.WriteConcernException: Write failed with error code 8 and error message 'assertion src/mongo/db/storage/mmap_v1/extent.h:81'
at com.mongodb.operation.BaseWriteOperation.convertBulkWriteException(BaseWriteOperation.java:239)
at com.mongodb.operation.BaseWriteOperation.access$300(BaseWriteOperation.java:60)
at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:146)
at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:133)
at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:230)
at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:221)
at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:133)
at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:60)
at com.mongodb.Mongo.execute(Mongo.java:782)
at com.mongodb.Mongo$2.execute(Mongo.java:765)
at com.mongodb.DBCollection.executeWriteOperation(DBCollection.java:333)
at com.mongodb.DBCollection.insert(DBCollection.java:328)
at com.mongodb.DBCollection.insert(DBCollection.java:319)
at com.mongodb.DBCollection.insert(DBCollection.java:289)
at com.mongodb.DBCollection.insert(DBCollection.java:255)
at com.mongodb.DBCollection.insert(DBCollection.java:192)
与此类似,如果我导入新的集合,我会收到错误: 查询:
mongoimport --db testdb --collection test --file test.json
2016-07-07T18:31:13.599+0000 error inserting documents: assertion src/mongo/db/storage/mmap_v1/extent.h:81
答案 0 :(得分:0)
此错误表示Mongodb数据文件已损坏。
你应该运行mongod
mongod --repair