0

I am querying a collection and am receiving Btree::insert: key too large to index, failing. This is because I have an index on a Stringfield and the value is too big. I would like to query my db and simply throw away the ones that are too big but I don't know how to query on the size of a field.

I am using mongoengine and the GUI robomongo. If anyone knows how I could get these documents based on the size of one field, it would be greatly appreciated.

Iluvatar14
  • 699
  • 1
  • 5
  • 18

1 Answers1

0

you can run your mongod instance with

sudo mongod --setParameter failIndexKeyTooLong=false

however you should probably model your data a bit more. read some details here.

https://docs.mongodb.com/manual/tutorial/model-data-for-keyword-search/

satish chennupati
  • 2,602
  • 1
  • 18
  • 27