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

Run the Explain command on a db Find

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0
    • Component/s: None
    • Labels:

      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.

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

              Created:
              Updated:
              Resolved: