4

I'm using Mongo 2.2. How can I access the query info using C#?

Currently have the following to get my data:

 var records = _collection.Find(filters).ToList<Vehicle>();

I was trying to add a .explain() similarily to what I can do in Robomongo at the end of my query:

var records = _collection.Find(filters).explain();

However, it does not exist, I believe because its not a cursor. Does anyone know how I can get this query data in C#?

Mafii
  • 7,227
  • 1
  • 35
  • 55
Evgeny Lukiyanov
  • 498
  • 1
  • 5
  • 20

1 Answers1

0

There is .Explain() method of MongoCursor class resulting from FindAs() method of MongoCollection class. I found an answer from this link.

var qLinq = Query<T>.Where(x => x.name=="jim");

var exp = Collection.FindAs<T>(qLinq).Explain()
Community
  • 1
  • 1
vincentluth
  • 149
  • 5