mongodb createIndex() can't capture error about "WiredTigerIndex::insert: key too large to index, failing"

46 views
Skip to first unread message

stanxi...@gmail.com

unread,
Sep 20, 2018, 10:08:05 PM9/20/18
to node-mongodb-native
When I execute a command to create index in mongo shell , it return err as below:
```
db.qrcode.createIndex({"accountId":1,"name":1}, {"backgroud": true})
{
"ok" : 0,
"errmsg" : "WiredTigerIndex::insert: key too large to index, failing  1470 { : \"56f37cb8e4b089e98d52ab0e\", : \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...\" }",
"code" : 17280
}

```

But  when I use mongodb driver in my nodejs code to invoke createIndex() method, it return index name and did't throw any error !

I executed getIndexes() command  in mongo shell, In fact the index  was not inserted into mongo server.

So I guess the error was not captured in mongodb driver.
Reply all
Reply to author
Forward
0 new messages