[CSHARP-1019] Need a simple way to view the generated LINQ Queries. Created: 22/Jul/14  Updated: 22/Apr/15  Resolved: 22/Apr/15

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

Type: Improvement Priority: Minor - P4
Reporter: Eyal Post Assignee: Unassigned
Resolution: Done Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Rewrite Linq

 Description   

We need a simple way to discover the generated queries when using LINQ.

This will likely take the form of either using .ToString(), which will generate json that can be pasted into the shell, or by using a cast to see more in depth and native representations of the query.

Original
-----------

This allows to easily get the native query of every LINQ query by using the GetMongoQuery() method withoyt needing to actually cast it to the correct MongoQueryable <SomeType> class.
This is great for debugging aids (visualizers) and performance logging (i.e. log every query taking longer than x milliseconds)



 Comments   
Comment by Craig Wilson [ 22/Apr/15 ]

This has been fixed with CSHARP-601. You can call ToString() on the IQueryable and it will write out the aggregation framework pipeline that will be sent to the server.

Comment by Eyal Post [ 22/Jul/14 ]

Hmm.. Having an IMongoQueryable interface with a single GetMongoQuery() method and inheriting from this interface will also suffice and would probably take a minute less to implement
please consider!

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