mongo抛出异常:com.mongodb.MongoException: Lock not granted. Try restarting the transaction 解决方式

原因是使用findandmodify中的query 条件对应的字段没有建索引,导致mongo查询缓慢,形成工作队列,在mongo中建好索引后问题得到解决。

db.demo.createIndex({"id": 1}, {name: "index_id"});

参考链接:点击打开链接

I have some problem.
I am actually getting this error because of a lot updates without the right index.
It looks like each update requires too much time, so the queue of operations increases, and a lock related timeout is fired, and the operations on the queue are dropped out.After having setted the index up, the error does not appear anymore.


你可能感兴趣的:(mongo抛出异常:com.mongodb.MongoException: Lock not granted. Try restarting the transaction 解决方式)