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

Implemented Compound Indexes #229

Merged
merged 1 commit into from
Oct 4, 2015
Merged

Implemented Compound Indexes #229

merged 1 commit into from
Oct 4, 2015

Conversation

nkreipke
Copy link
Contributor

@nkreipke nkreipke commented Oct 2, 2015

Greetings!

I wanted to use compound indexes with the driver, but that feature was not implemented. Turns out it works by providing an array as an index:

Person.Db.GetAll<Person, string[]>(new[] { "a", "b", "c" }, "AbcIndex");

This is kind of awkward and makes it impossible to use compound indexes with varying types (object[] does not work). Furthermore, there was no way to programmatically create a compound index.

I extended the driver with a way to define those compound indexes. Here is how you can use it with GetAll:

Person.Db.GetAll<Person, CompoundIndexKeys>(CompoundIndexKeys.Make("a", "b", 10, true, 2.5), "AbcIndex");

And here is how you can create new compound indexes:

Person.Db.IndexCreate("AbcIndex", CompoundIndex<Person>.Make(a => a.SomeString, a => a.SomeOtherString, a => a.SomeNumber, a => a.SomeBool, a => a.SomeFloatingPoint));

Kind regards,
Nico

@mfenniak mfenniak merged commit ae83f54 into mfenniak:master Oct 4, 2015
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