I am using MongoDB.Driver 2.0.0. Is there any way to see a generated script from linq to MongoDB?
For example my query is like:
IFindFluent<ProductMapping, ProductMapping> findFluent = Collection.Find(
x => hashValues.Contains(x.UrlHash) && x.ProductTopic == topicId);
How would this (or more complex queries) be represented in the MongoDB shell?
Please see i3arnon's answer for a client-side method using Render()
that is usually easier.
You can use the integrated mongodb profiler to see what the database has actually received:
db.setProfilingLevel(2); // log every request
// show the requests that mongodb has received, along with execution stats:
db.system.profile.find().pretty()
Alternatively, you can step in the source code of the driver and wait for it to actually create the message. That, however, requires compiling the driver from source, AFAIK.