Description
Is your feature request related to a problem? Please describe.
CosmosDbPartitionedStorage
assumes the container (i.e. collection - V3 renamed this) it is working with is partitioned by /id
. This means it can't work with non-partitioned containers. This means that folks can't migrate from the old CosmosDbStorage
without a lot of hassle.
Describe the solution you'd like
CosmosDbPartitionedStorage
should check to see what the partition key path is on the ContainerProperties
object (which we can get from the createIfNotExists call), and check to see if it's /_pk
. If it is, then we can attempt to use the PartitionKey.Empty
value for partition key (which is what non-partitioned containers look like.
Describe alternatives you've considered
Doing a full migration would be interesting as well, but it'd break existing apps using the old provider. A full migration without breaking existing apps requires a process like so:
- All apps on old storage
- Some apps on new storage, using non-partitioned strategy, some on old storage
- All apps on new storage, using non-partitioned strategy. No old storage code is running anymore.
- Migrate to new partitioning scheme
This would also require some additional metadata documents that describe the state of the storage and all the stores would need to poll that document regularly. This is probably a lot of work and it still requires the proposed solution is implemented.
I think we should scope out full migration for the time being.
Additional context
N/A
[enhancement]