Skip to content

Linq index#139

Closed
einaregilsson wants to merge 2 commits into
mongodb:masterfrom
einaregilsson:linq-index
Closed

Linq index#139
einaregilsson wants to merge 2 commits into
mongodb:masterfrom
einaregilsson:linq-index

Conversation

@einaregilsson

Copy link
Copy Markdown

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

Einar Egilsson added 2 commits November 18, 2012 21:55
…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
Copy Markdown
Contributor

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

@einaregilsson

Copy link
Copy Markdown
Author

Any ideas if/when this might make it in?

@craiggwilson

Copy link
Copy Markdown
Contributor

This is currently in code review.

@craiggwilson

Copy link
Copy Markdown
Contributor

pushed to master. Thanks!!!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants