赞
踩
我用java连接mongodb抛出错,见过??。。
茶什i
2020-04-01 14:06:45
public static void main(String[] args) { // Mongo m = new Mongo(); DB db = MongoUtils.getDB("test") ; DBCollection coll = db.getCollection("mycollection") ; DBObject documents = new BasicDBObject(); documents.put("name", "abc") ; documents.put("age", 24) ; coll.insert(documents) ; }之后抛出此错误:com.mongodb.MongoException: org.bson.BsonInvalidOperationException: Document does not contain key versionArray at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:112) at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127) at java.lang.Thread.run(Thread.java:745)Caused by: org.bson.BsonInvalidOperationException: Document does not contain key versionArray at org.bson.BsonDocument.throwIfKeyAbsent(BsonDocument.java:757) at org.bson.BsonDocument.getArray(BsonDocument.java:140) at com.mongodb.connection.DescriptionHelper.getVersion(DescriptionHelper.java:106) at com.mongodb.connection.DescriptionHelper.createConnectionDescription(DescriptionHelper.java:56) at com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:85) at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:43) at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:98) ... 2 more
分享到
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。