0

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 }

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.