OrleansContrib / Orleans.Providers.MongoDB

A MongoDb implementation of the Orleans Providers: Membership, Storage and Reminders.
MIT License
105 stars 44 forks source link

CreateShardKeyForCosmos does not create sharded collection #98

Closed tomhreb closed 2 years ago

tomhreb commented 2 years ago

Hello, I think that the method GetCollection -> https://github.com/OrleansContrib/Orleans.Providers.MongoDB/blob/84a3237dbfb6f6510ca2ed954304d7871ee3edb7/Orleans.Providers.MongoDB/StorageProviders/MongoGrainStorage.cs#L193-L200

is missing specification of shard key as for CosmsoDB as per the documentation / it has to be created differently for CosmosDB.

Creating a collection via command below creates the collection really sharded, at least according to Azure Monitor.

db.createCollection(<collectionName>, {
    "shardKey": "_id",
    "indexes": [{key: {_id: 1}}}]
});
SebastianStehle commented 2 years ago

Could be, not a CosmosDB user. PRs are welcome ;)

tomhreb commented 2 years ago

Great :) See PR #99