Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linq index #139

Closed
wants to merge 2 commits into from
Closed

Linq index #139

wants to merge 2 commits into from

Conversation

@einaregilsson
Copy link
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();

…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.
.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
Copy link
Contributor

craiggwilson commented Nov 19, 2012

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

@einaregilsson
Copy link
Contributor Author

einaregilsson commented Jan 15, 2013

Any ideas if/when this might make it in?

@craiggwilson
Copy link
Contributor

craiggwilson commented Jan 19, 2013

This is currently in code review.

@craiggwilson
Copy link
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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.