Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1250

Run the Explain command on a db Find

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Case:

      Description

      Using the new C# 2.0 driver, I cannot seem to figure out how to run an Explain query.

      An example query is:

       
      var obj = await someCollection.Find(Builders<SomeType>.Filter.Eq("field", "value")).FirstOrDefaultAsync();
      

      someCollection is of type IMongoCollection<SomeType>.
      the Find command returns an IFindFluent<SomeType,SomeType> but this object has no Explain() method.

      I am importing the following namespaces:

      using MongoDB.Bson;
      using MongoDB.Driver;
      

      I am trying to do this without using the legacy driver but cannot figure out how to do it even with the legacy driver without creating a legacy connection since my Database connection returns an IMongoDatabase and none of the find options returns a MongoQuery.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              craiggwilson Craig Wilson
              Reporter:
              pgordon@truckdown.com Peter Gordon
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: