Reputation: 123
Trying to insert long string to Mongodb via Node (Mongoose as ODM), Failing causing the error mentioned in title.
Tried inserting the string via Terminal, MongoDB Compass but no luck.
driver: true,
name: 'MongoError',
index: 0,
code: 17280,
errmsg:
'WiredTigerIndex::insert: key too large to index, failing 1719
The String needs to be inserted without any index loss. Running Mongo 4.0.3
Upvotes: 1
Views: 770
Reputation: 123
Created a Hashed Index on that key using:
db.collection.createIndex( { _id: "hashed" } )
Now it is successfully inserting. But do we have any other solution ?
Upvotes: 2