When MongoDB inserts data in batch, the data cannot be queried by executing the query, and the data can be queried only after the insertion is completed
This is the place where mongodb has been criticized and rejected-read and write locks. Before version 2.2, it was global, that is, when writing, the entire database was restricted from reading and writing. Later, I slowly supported the collection level lock, but if you are 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 the document level lock. So I’m sorry, I can’t solve the problem you are facing. I think I can only avoid this situation from the business, or divide the library and separate reading from writing.