| Steps To Reproduce: |
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',
|
...
|
}
|
]
|
|