OrleansContrib/Orleans.Providers.MongoDB

CreateShardKeyForCosmos does not create sharded collection

tomhreb opened this issue · 2 comments

Hello,
I think that the method GetCollection ->

database.RunCommand<BsonDocument>(new BsonDocument
{
["key"] = new BsonDocument
{
["_id"] = "hashed"
},
["shardCollection"] = $"{database.DatabaseNamespace.DatabaseName}.{collectionName}"
});

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}}}]
});

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

Great :) See PR #99