mongorover
mongorover copied to clipboard
Index support collaboration
@yzubkov check out #67 and #68
@yzubkov,
I made some changes to your code.
You want to have this type of format:
if (something) {
and not:
if(something){
It's harder to read that way. Although the rest of this codebase isn't super easy to read, that is a step in the right direction.
error.code isn't a valid way of checking that something is valid or not. It's actually mongoc_cursor_error(...) seen here. That's my bad, it wasn't very apparent at first.
I'll try to get more tests out tomorrow.
A couple things for you to do if you want:
- [ ] Make me a collaborator on your fork so I can alter your PRs before merging.
- [ ] I'd like the functions to be like
create_indexand notcreateIndex. - [ ] I'd like you to use
list_indexesinstead offindIndexes, as that is what pymongo does - [ ] Start implementing index_information and reindex and add those to your examples script that you've been working on so it's easier for me to get up to speed.
- [ ] Ensure the behavior in mongorover's index functions follow pymongo's as closely as possible.
Thank you very much for merging the PR's into the "index_support" branch. I have updated my branch to reflect what is in "index_support" and additionally made the recommended changes to re-name the functions to have the underscore character.
I have also renamed a parameter textIndexVersion to version , because it has nothing to do with text indexing and is just a plain index version as mentioned in this mogoDB documentation: here. Should I make these same PR's into the "index_support" branch?
Because we want to stay close to PyMongo, I want to document the following difference that I noticed when we are asking C driver to auto-generate an index name based on the supplied list of keys/arguments. When we supply the following keys: {name = 'text', cost = -1}, the C function opt.name = mongoc_collection_keys_to_index_string(&keys); will return name_text_cost_0. It will return the same index name if we change the directional indicator from descending to ascending and give it {name = 'text', cost = 1}. In PyMongo the generated index name would be different between the two scenarios, as you can see here
I am glad that you helped me get this as far as we got it currently. My focus from the start was to make sure we have the baseline indexing support so that I am able to do text searches on a collection. I do feel that the additional index_information and reindex commands will be beneficial to this driver and I would be glad to help develop some tests and modify example script to demo these new functions, although not sure how soon.
Yes, PR's into the index_support branch will work just fine.
I would just use the C driver's auto-generate functionality.
Not to worry, thanks for helping out. I'll at least take what you've started and start moving towards an actual feature.
Thanks for working with me @yzubkov, I'm going to close this PR because I don't think I'll be able to provide the necessary support + debugging of a release. Sorry I didn't close this PR and archive this project earlier.