...
I noticed at first when using the Java driver, then when using mongosh, that the database profiler does not record data about getmore commands issued when I am watching a database, but does record those commands when I am watching a collection. I observed this problem with the following setup: OS: macOS ISA: ARM 64 MongoDB: tried both 7.0.5-ent, 7.2.0-ent deployment: P-S-S replica set storage engine: tried both wiredTiger, inMemory
xgen-internal-githook commented on Tue, 14 Jan 2025 11:47:15 +0000: Author: {'name': 'Rui Liu', 'email': '33423526+lriuui0x0@users.noreply.github.com', 'username': 'lriuui0x0'} Message: SERVER-86007 Allow collectionless getMore command to be profiled (#30771) GitOrigin-RevId: 59797f5f1a2bd31b582a5be371ebebe82335a719 Branch: master https://github.com/mongodb/mongo/commit/56c28c994851bd6f9da8b97a4dfbfdd5d3587f16
Run the following code in mongosh use myDb; const session = db.getMongo().startSession(); db = session.getDatabase(db.getName()); db.runCommand({ profile: 0 }); db.dropDatabase(); { db.runCommand({ profile: 2 }) const watchCursor = db.watch(); watchCursor.tryNext(); db.myColl.insertOne({}); db.system.profile.find({}, {op: 1, ns: 1, command: 1}); } db.runCommand({ profile: 0 }); db.dropDatabase(); session.endSession(); and see that only the insert into myDb.myColl is recorded despite the profiling level being 2: [ { op: 'insert', ns: 'myDb.myColl', ... } ] If we do db.myColl.watch() instead of db.watch() in the scenario specified above use myDb; const session = db.getMongo().startSession(); db = session.getDatabase(db.getName()); db.runCommand({ profile: 0 }); db.dropDatabase(); { db.runCommand({ profile: 2 }) const watchCursor = db.myColl.watch(); watchCursor.tryNext(); db.myColl.insertOne({}); db.system.profile.find({}, {op: 1, ns: 1, command: 1}); } db.runCommand({ profile: 0 }); db.dropDatabase(); session.endSession(); then we can see the corresponding getmore commands in system.profile: [ { op: 'getmore', ns: 'myDb.myColl', ... }, { op: 'getmore', ns: 'myDb.myColl', ... }, { op: 'insert', ns: 'myDb.myColl', ... } ]
MongoDB Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.