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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 1.4
    • 1.3.1
    • None
    • None

    Description

      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());

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: