-
Notifications
You must be signed in to change notification settings - Fork 180
RUST-273: Implement Create indexes #188
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
Conversation
@Stargateur Hey! Anything I could help with to get this shipped? Interested in this for a project of mine 🙂 |
It's not urgent for me so I put it on hold, what stop me was index have type and possible option was different for each type example: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#option-for-collation. I need to take time to think how to implement this properly. Be aware if this is urgent for you that you can use command to do it manually. |
@saghm I must say I have trouble to understand how is design the code, so far I think I'm doing ok but I have trouble to understand how to handle error. A little advice would be very welcome. |
So far it's work but write unit test is not my best specially understand how mongodb do it, and I still struggle with handle the error. |
It seems that https://jira.mongodb.org/browse/RUST-273 is right one. |
@saghm could you comment on this pull request? |
Hello! You're correct that RUST-273 is the ticket we're using to track the index management work now; we had a couple of tickets covering it, so we wanted to pick one to de-duplicate. As for the pull request itself, we're happy to merge a working implementation if one is provided, but our team is currently focusing in other areas, and we don't have the bandwidth to provide extensive guidance to the community on how to implement this. We do have plans to implement this functionality at some point in the future, but it's currently not our highest priority due to the fact that using |
Is something similar still being worked on?
Since you mention a workaround is there documentation for it? I'm unsure on how I'd use |
I didn't have time or/and will to continue this work today, as mongodb is now in 2.0 I expect a lot of change in the code, I did this draft pull request to get help on it if anyone wanted to contribute to create indexes feature. Everyone feel free to copy/use and make your own pull request. This PR only purpose is to share work. |
The To create an index via let response = db
.run_command(
doc! {
"createIndexes": "coll",
"indexes": [
{
"key": { "x": 1 },
"name": "my_index",
"unique": true
},
]
},
None,
)
.await?;
println!("{}", response); Output:
|
Hi @Stargateur, thank you for your work on this pull request! We've recently completed an implementation of index management, so I'm going to close this out. Index management will be included in the 2.0.0 release of the driver which will be out soon. |
https://jira.mongodb.org/browse/RUST-458