Meteor-Community-Packages / meteor-schema-index

Control some MongoDB indexing with schema options
MIT License
38 stars 17 forks source link

Almost a complete rewrite. Adds much more flexibility including supp… #4

Closed dpankros closed 8 years ago

dpankros commented 8 years ago

This is almost a complete rewrite. See the docs and you can readily discern what's different. (Maybe I should add a migration section to the README?)

In short, this adds support for all mongo indexes and all their options, including compound indexes (thus, closing bugs #1 and #3).

Instead of everything being in the schema, the column-specific options are there. You just need to call collection.attachIndex(name, options) to actually create the index (assuming the schema is already attached). Options are the full options to mongo.CreateIndex. Further, if you call attachIndex before you call attachSchema, the index will be queued up until the schema is attached. There is also a rebuild option to rebuild an index that has changed, rather than separately dropping and re-adding it.

All the tests work, with slight modifications to accommodate the syntax change in the schema and calling the new attachSchema method.

A previous build has accidental test failures caused by the previous version and c2's reliance on using indexes with the form c2_fieldName for all indexes. The tests were updated to use this form (and thus pass), but the method used by C2 for picking out invalid keys will not work with composite indexes.

Truly integrating this requires work on c2 to improve the invalidKeys handling, and thus, I'd appreciate some feedback for how you would like to generalize that aspect of c2.

dpankros commented 8 years ago

At this point, does it even matter? It might have been a typo. I can't say for sure and I don't remember (it was 6 months ago).

I can't get spacejam to work on my development machine to fix the error that is causing the problems and the spacejam group is completely unhelpful as to identifying a cause. (It flat out won't start on my laptop but on our CI servers it periodically hangs for no reason.)

I'll just continue to use this update myself and I'll close this merge request.

gregory commented 8 years ago

I need to find a way to setup composite indexes, and found out your PR. I was just curious of what that mysterious line was :)

dpankros commented 8 years ago

No idea.

From: Grégory Horion notifications@github.com Reply: aldeed/meteor-schema-index reply@reply.github.com Date: August 4, 2016 at 2:51:52 PM To: aldeed/meteor-schema-index meteor-schema-index@noreply.github.com Cc: David Pankros dpankros@yahoo.com, State change state_change@noreply.github.com Subject:  Re: [aldeed/meteor-schema-index] Almost a complete rewrite. Adds much more flexibility including supp… (#4)

I need to find a way to setup composite indexes, and found out your PR. I was just curious of what that mysterious line was :)

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.