TylerBrock / mongo-hacker

MongoDB Shell Enhancements for Hackers
tylerbrock.github.io/mongo-hacker
MIT License
1.79k stars 235 forks source link

MongoDB 4 transactions and db.getProfilingStatus() #193

Closed rbro closed 5 years ago

rbro commented 6 years ago

I am running into a small issue using mongo-hacker with MongoDB 4 when using transactions.

From testing, it appears to be related to the call db.getProfilingStatus(), which seems to hang if there are any open transactions.

The below is the full example I tried. Could the logic be updated so that the call doesn't hang? Thanks for your help.

Run the below in session 1:

use test;
db.createCollection('col1');
session = db.getMongo().startSession();
session.startTransaction();
session.getDatabase("test").col1.insert({"a" : "b"});

and then in session 2, run:

use test;
db.col1.find();

The find() call is hangs for me until I run "session.commitTransaction()" in session 1.