Sagar Varpe
Sagar Varpe

Reputation: 3599

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.lang.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 }

Upvotes: 0

Views: 1417

Answers (1)

Michael Papile
Michael Papile

Reputation: 6856

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).

Upvotes: 1

Related Questions