mongodb - Key length for Compound index -
i'm looking upgrade mongodb 2.4.x instance 2.6. part of process ran db.upgradecheckalldbs()
method ensure data in correct state upgrade. check found number of records in database there index defined on field, key exceeded 1024 byte limit. is, saw errors of form:
document error: key index { "v" : 1, "name" : "field_1", "key" : { "field" : 1 }, "ns" : "mydb.users" } long document
indicating document contained value in field
field exceeded 1024 bytes (the limit key).
this straightforward resolve (i can remove index on field
), compound indexes. ex: have index following:
document error: key index { "v" : 1, "name" : "email_-1_meta_-1", "key" : { "email" : -1, "meta" : -1 }, "ns" : "mydb.users" } long document
does mean document had length of email
, meta
fields combined surpass 1024 bytes? or 1024 bytes each field, or other combination? is, compound index, how determine key length exceeds 1024 byte limit?
the total size of index entry, can include structural overhead depending on bson type, must less 1024 bytes.
if have compound index on f1, f2, f3 -> fi+f2+f3+structural overhead < 1024
Comments
Post a Comment