Details of concurrency control

Hi

I would like to know how do I view some details of concurrency control in mongo db 4.4.5 and MongoCompass 1.26.1

Assuming the following example:

4 update on the same field…

db.work_order.updateMany ({id_work_order: {$ gt: 1}}, {$ set: {service_description: “TEST1”}})
db.work_order.updateMany ({id_work_order: {$ gt: 1}}, {$ set: {service_description: “TEST2”}})
db.work_order.updateMany ({id_work_order: {$ gt: 1}}, {$ set: {service_description: “TEST3”}})
db.work_order.updateMany ({id_work_order: {$ gt: 1}}, {$ set: {service_description: “TEST4”}})

how do I see details like: Represents Shared (S) lock or Represents Exclusive (X) lock.

thanks

Hi @MATEUS_GUILHERME_DA, welcome to the forums!

If you want to find out more about concurrency in MongoDB and the type of locking used, I’d suggest checking out our concurrency FAQ page.

In terms of using Compass, you will need to use the beta functionality of the embedded MongoDB Shell (see this docs page for more details). You can use that shell to issue your commands to the database and check the locks either with db.serverStatus() or with db.currentOp().

Alternatively, you can use Compass to insert the data and in a separate terminal window have the command line mongostat running so you can then see the locking as the operations occur.

Hope this helps.

Kindest regards,
Eoin

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.