Linq index #139

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
@einaregilsson
Contributor

einaregilsson commented Nov 18, 2012

Couple of features for the Linq provider to make it more powerful, and more on par with the lower level API:

  1. Explain extension method on IQueryable
BsonDocument plan = 
    collection.AsQueryable<T>().Where(o=>o.Name == "test").Explain();
  1. WithIndex extension method on IQueryable, for index hinting. Can take a string or BsonDocument:
collection.AsQueryable<T>().Where(o=>o.Name == "test").WithIndex("foo").ToList();
collection.AsQueryable<T>().Where(o=>o.Name == "test").WithIndex(new BsonDocument("Name",1).ToList();

einaregilsson added some commits Nov 18, 2012

Add .Explain() extension method to IQueryable<T> to explain Linq quer…
…ies.

The extension method operates on IQueryable<T> and can therefore not operate
on .Max, Min, First, Last or any methods that return a scalar. It can also
not operate on .Distinct queries since they call a specific method on the
collection and don't give us access to any cursor.
Added .WithIndex method to Linq queries for index hinting.
.WithIndex can take a string or a BsonDocument as an index hint.
It's an extension method on IQueryable<T> and returns IQueryable<T>.
Example:

var results = _collection.AsQueryable<T>.WithIndex("foo").Where(x=>x.Name == 1).ToList()
@craiggwilson

This comment has been minimized.

Show comment
Hide comment
@craiggwilson

craiggwilson Nov 19, 2012

Contributor

Thanks for the pull requests. These ideas sound great. We'll review and get back to you...

Contributor

craiggwilson commented Nov 19, 2012

Thanks for the pull requests. These ideas sound great. We'll review and get back to you...

@einaregilsson

This comment has been minimized.

Show comment
Hide comment
@einaregilsson

einaregilsson Jan 15, 2013

Contributor

Any ideas if/when this might make it in?

Contributor

einaregilsson commented Jan 15, 2013

Any ideas if/when this might make it in?

@craiggwilson

This comment has been minimized.

Show comment
Hide comment
@craiggwilson

craiggwilson Jan 19, 2013

Contributor

This is currently in code review.

Contributor

craiggwilson commented Jan 19, 2013

This is currently in code review.

@craiggwilson

This comment has been minimized.

Show comment
Hide comment
@craiggwilson

craiggwilson Jan 24, 2013

Contributor

pushed to master. Thanks!!!

Contributor

craiggwilson commented Jan 24, 2013

pushed to master. Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment