过去多啦不再A梦2017-04-25 09:04:03
This is something that mongodb has always been criticized for - read-write locks, and before version 2.2 it was global, that is, during write operations, the entire database was restricted from reading and writing. Later, collection-level locks were gradually supported. However, if you are talking about reading and writing the same collection, there is still no way to do it at the same time. I don't know if any engine supports document-level locks. So I'm sorry, I can't solve the problem you encountered. I think I can only avoid this situation from a business perspective, or divide the database into read-write separation.
習慣沉默2017-04-25 09:04:03
From your description, you should be using a version before 2.8. Because document level locking is supported from 2.8 onwards. After 3.0, mongodb exited the WiredTiger engine. Different users can edit and query different documents in the same collection at any time. As for batch insertion queries, unless you want high-intensity concurrency. Basically, there is no problem with the read and write speed of mongodb. This is what he exists for.