[CSHARP-1541] Add support for $comment for profiling Created: 21/Jan/16  Updated: 03/Mar/22  Resolved: 25/Feb/22

Status: Closed
Project: C# Driver
Component/s: Diagnostics, Operations
Affects Version/s: 2.2.2
Fix Version/s: 2.15.0

Type: Improvement Priority: Minor - P4
Reporter: Aristarkh Zagorodnikov Assignee: Boris Dogadov
Resolution: Done Votes: 5
Labels: size-medium
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CSHARP-3929 Add support for the comment field to ... Closed
Related
related to CSHARP-4067 Add tests for all helpers that suppor... Backlog
related to DRIVERS-742 Add support for the comment field to ... Closed
Case:
Backwards Compatibility: Fully Compatible

 Description   

I see that the $comment partially made its way into the driver in the form of the "Comment" field for FindOptions. I believe it would be logical to extend its support for other cases that contain queries (updates, FindAndWhatever, aggregation).

P.S. CSHARP-692 resolution is no longer relevant since 3.0 if I understand correctly



 Comments   
Comment by Githook User [ 25/Feb/22 ]

Author:

{'name': 'Boris', 'email': 'boris.dogadov@mongodb.com', 'username': 'BorisDog'}

Message: CSHARP-1541: Add support for $comment for profiling
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/ba40db6a4614ba251f46f34ac44b861c3a13524e

Comment by Aristarkh Zagorodnikov [ 16/May/20 ]

The lack of support for $comment in findAnd* commands  makes implementing a robust end-to-end tracing solution impossible. Any chances this will make into some future release?

Comment by Robin Munn [ 06/Sep/16 ]

I am currently trying to track down an error in a C# application that uses MongoDB queries, and I'm seeing lots of "$msg" : "query not recording (too large)" entries in the Mongo log. A Google search led me to http://grokbase.com/t/gg/mongodb-user/122nd2nd3k/query-not-recording-too-large which implied that the $comment functionality should be available in all the officially-supported drivers. Right now its absence means that I can't easily track down which queries are causing the problem. (I'm getting a MongoWaitQueueException being thrown when I thought I was using the Mongo connection in a single-threaded way, and I've been trying to track it down for two weeks now with no success so far).

So I, for one, would really appreciate having $comment available so that I could tag each query with the source file and line number (in our C# source) that it came from. That would have been an immense help in my current bug hunt.

UPDATE: It turns out that the cause of my problem was a bug in Mono 3.12. I left a comment on CSHARP-1144 with all the details.

Comment by Aristarkh Zagorodnikov [ 25/Jan/16 ]

Thank you, Craig, looking forward to any outcome of this.

Comment by Craig Wilson [ 25/Jan/16 ]

Hi Aristarkh,

I'm looking into this. The documentation certainly implies what you are hearing. I haven't been made aware of this feature. I'm going to re-open this ticket as it seems to be a legitimate request.

Craig

Comment by Aristarkh Zagorodnikov [ 21/Jan/16 ]

After reading the docs (https://docs.mongodb.org/v3.2/reference/operator/query/comment/#behavior) I was under impression that $comment is supported everywhere when matching is involved, incliding update query filters and $match aggregation pipeline fragments. Is this a documentation issue?

Comment by Craig Wilson [ 21/Jan/16 ]

Hi Aristarkh,

Commenting has been available in the driver for a long time. In 2.0, we made it a named parameter, but it could always have been passed as a modifier. However, comments are not available for all commands. In fact, it is only available for the find command (and the old OP_QUERY) stuff. This translates to it only being available in FindOptions. If you are interested in this feature for other things, I'd suggest you file a server ticket.

Craig

Generated at Wed Feb 07 21:39:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.