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

Explain doesn't send Fields to the server resulting in indexOnly value sometimes being incorrect

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.4
    • Affects Version/s: 1.3.1
    • Component/s: None
    • None

      The Explain method in the C# driver doesn't pass the Fields value to the server resulting in the indexOnly value sometimes being incorrect.

      To reproduce:

      collection.Drop();
      collection.EnsureIndex("A", "_id");
      collection.Insert(new BsonDocument { { "_id", 1 }, { "A", 1 } });
      collection.Insert(new BsonDocument { { "_id", 2 }, { "A", 2 } });
      collection.Insert(new BsonDocument { { "_id", 3 }, { "A", 3 } });
      
      var query = Query.EQ("A", 1);
      var fields = Fields.Include("_id");
      var cursor = collection.Find(query).SetFields(fields);
      var explain = cursor.Explain();
      Console.WriteLine(explain.ToJson());
      

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: