开发者

Exception in Mongo java client 2.4

My pc is running with mongo 1.6.5 .

One of my collections has 973525 records when I try to find distinct key on that collection its giving me Exception

the query is

db.collection.distinct("id")


java.l开发者_如何学Cang.IllegalArgumentException: 'ok' should never be null...
    at com.mongodb.CommandResult.ok(CommandResult.java:30)
    at com.mongodb.CommandResult.throwOnError(CommandResult.java:60)
    at com.mongodb.DBCollection.distinct(DBCollection.java:756)
    at com.mongodb.DBCollection.distinct(DBCollection.java:741)
    at com.test.TestMongo$.<init>(TestMongo.scala:26)
    at com.test.TestMongo$.<clinit>(TestMongo.scala)
    at com.test.TestMongo.startTesting(TestMongo.scala)
    at com.test.Main.main(Main.java:13)

And when i try same query in mongo terminal gives error

Thu Mar 10 21:40:20 uncaught exception: error { "$err" : "Invalid BSONObj spec size: 8692881 (91A48400)", "code" : 10334 }


This error comes when you have a document that is too large. You can upgrade to 1.8 where the max document size is 16MB. Mongo 1.6x has max size of 8MB which that document is slightly larger than. You may be able to solve this in a repair (run mongod --repair, may take a long time).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜