[CSHARP-1277] Sending queries to $cmd causes the server to reject the query. Created: 12/May/15  Updated: 18/Mar/19  Resolved: 18/Mar/19

Status: Closed
Project: C# Driver
Component/s: Operations
Affects Version/s: 2.0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Craig Wilson Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The driver wraps all queries in the $query meta operator. However, the $cmd collection doesn't seem to respect that and closes the connection causing an EndOfStreamException in the driver.

The does NOT affect general purpose commands. Rather, it affects something like this, getting the current op:

var result = client
                .GetDatabase("admin")
                .GetCollection<BsonDocument>("$cmd.sys.inprog")
                .Find(new BsonDocument("$all", true))
                .ToListAsync()
                .GetAwaiter().GetResult();


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