[CSHARP-920] Add strongly typed explain method Created: 05/Mar/14  Updated: 03/Sep/14  Resolved: 03/Sep/14

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

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

.NET


Backwards Compatibility: Fully Compatible

 Description   

To explain a query presently we pass in a type but we receive a BsonDocument. That works, but it would be so much better to return a strongly typed object that matches the data returned from explain.

Today:
public static BsonDocument Explain<T>(this IQueryable<T> source)

Tomorrow:
public static QueryPlan Explain<T>(this IQueryable<T> source)

QueryPlan is a class that (AFAIK) is yet to be defined. I have a working version which returns a static type (which has properties you might expect like CursorType, etc).

I would like to submit this back to the driver. What GitHub branch would be best to start from and to issue a pull request back to?



 Comments   
Comment by Craig Wilson [ 03/Sep/14 ]

The server is completely revamping how explain works. The result of this that the effort to create a strongly typed explain that works consistently across server versions is going to be very difficult and very finicky. Ultimately, we think it will be more of a problem than an aid and have decided to not do this. Thanks for the idea and PR.

Craig

Comment by Michael Kennedy [ 05/Mar/14 ]

I added a pull request to GitHub:

https://github.com/mongodb/mongo-csharp-driver/pull/177

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