MongoDB无法查询数据
PHP中文网
PHP中文网 2017-04-25 09:02:03
0
2
802

MongoDB批量插入数据时,执行查询无法查询到数据,插入完成后才查询到数据

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
过去多啦不再A梦

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.

習慣沉默

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template