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

Sharding Key Provisioning for Collections #357

Open
dandrejvv opened this issue Jun 2, 2023 · 2 comments
Open

Sharding Key Provisioning for Collections #357

dandrejvv opened this issue Jun 2, 2023 · 2 comments
Labels
enhancement Enhancements & features moderate-change Moderate changes required

Comments

@dandrejvv
Copy link

I understand that Collections can be created with a Sharding key for MongoDB using the API tools, I do notice that the MongoFramework does not allow me to create a Collection with a Sharding Key.

Is there a reason for that or is that something that is in the pipeline?

The issue is just that once you've created a Collection without one, you can't change it after the fact to have one; and working with MongoFramework, any Entity I add to the app automatically gets its own Collection added hence why I'm asking this question.

Any insights would be appreciated.

@Turnerj Turnerj added the enhancement Enhancements & features label Jun 3, 2023
@Turnerj
Copy link
Member

Turnerj commented Jun 3, 2023

Thanks for raising this @dandrejvv - I didn't have plans for this (wasn't on the top of my mind) but after doing some digging into it now, it looks like the MongoDB Driver doesn't expose a nice way to do sharding keys without falling back to running a raw command.

I'm not against doing this but it makes it a more complicated option to integrate into MongoFramework.

Additionally, it does sound like you actually can change a shard key after creation as of MongoDB 5.0 so you might not be totally stuck with the current behaviour: https://www.mongodb.com/docs/manual/core/sharding-reshard-a-collection/#std-label-sharding-resharding

@dandrejvv
Copy link
Author

Thanks @Turnerj . Appreciate the feedback and for that link, I think that would be very useful.

@Turnerj Turnerj added the moderate-change Moderate changes required label Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancements & features moderate-change Moderate changes required
Projects
None yet
Development

No branches or pull requests

2 participants