How does mongodb handle concurrent requests?

WeChat Pay document mentioned: before checking and processing business data, data locks should be used for concurrency control. In order to avoid data confusion caused by function reentry, the Wechat server notifies the same payment result with a frequency of 15 br, 15, 30, 180, 1800, 1800, and 1800.
my question:
(1) there should be no concurrency in the same payment notification?
(2) is the concurrency frequently requested by Wechat server for the same API? It causes different payment notifications to request the interface at the same time, but the database is too late to read and write, resulting in concurrency?
(3) if there is concurrency, what is the solution for MongoDB?


  • for concurrency, please refer to my previous answer .
  • with regard to reentry, there is no specific understanding of WeChat Pay's interface specification, but there should be a unique key in the returned data. Like the transaction number? This serves as the unique index of the mongo table. Then catch & handle the error in the program.
Menu