Open dandrejvv opened 1 year ago
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
Thanks @Turnerj . Appreciate the feedback and for that link, I think that would be very useful.
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.