Try adding $comment in your queries, so that you can easily interpret and trace the profile log. For example, using .NET/C# driver you could utilise FindOperation.Comment property.
Foutunately, I can see that I can specify a comment within the FindOptionsBase.Comment property.
However, how can I do the same when doing an update command? For example:
FindOptions MyFindOptions = new FindOptions();
MyFindOptions.Comment = "token-001";
var cursor = collection.Find<BsonDocument>(new BsonDocument(), MyFindOptions);
Then you should be able to query it using the following:
collection = database.GetCollection<BsonDocument>("system.profile");
var filter = new BsonDocument{{"command.comment", "token-001"}};
var entries = collection.Find(filter);
Currently there is an open ticket for all MongoDB drivers to support this DRIVERS-742. In the mean time for update operations, you can attach $comment query operator on the query predicate. See more info on $comment behaviour. For example:
var updateOp = new BsonDocument{
{"$set", new BsonDocument{{"foo", "new"}} }};
var filter = new BsonDocument{
{"foo", "old"}, {"$comment", "token-002"}};
var result = collection.UpdateOne(filter, updateOp);
Then you should be able to query it using the following:
collection = database.GetCollection<BsonDocument>("system.profile");
var filter = new BsonDocument{{"command.q.$comment", "token-002"}};
var entries = collection.Find(filter);
The above snippet was executed with MongoDB .NET/C# v2.10.2 and MongoDB server v4.2.5.