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