1

I receive these errors:

ERROR: key too large len:2448 max:1024

and

[conn89] unindex failed (key too big?)

I'm using MongoDB 2.4.9 . Any Idea how can I fix these errors?

Pascut
  • 3,291
  • 6
  • 36
  • 64

2 Answers2

2

There is MongoDB issue about this error message

SERVER-11209: ERROR: key too large len:6597 max:1024 6597

And main issue with full explaination

SERVER-5290: fail to insert docs with fields too long to index, and fail to create indexes where doc keys are too big

The main trouble is limited size of index keys. If your index key larger that 1024, document cannot be indexed and will be unfindable in Mongo for some queries even if successfully inserted.

You have to revise your indexes and use smaller keys.

Nikolay
  • 1,949
  • 18
  • 26
  • Ok, thanks for your observation. If I upgrade to MongoDB 2.6 (latest version at this moment) will this problem still persist? As I understood, this problem might be fixed in the latest version of MongoDB. – Pascut Feb 11 '15 at 10:27
  • From 5290: "The fix for this issue must encompass both insert/update as well as failing during ensureIndex calls if this condition is violated (similar to a unique index constraint failing)." So on new MongoDB your big keys will fall-fast on insert. – Nikolay Feb 11 '15 at 10:38
0

There are several ways to solve this problem depending on the real case. See my answer: https://stackoverflow.com/a/40422313/1647971

Community
  • 1
  • 1
Rustem K
  • 1,212
  • 11
  • 27