4.2.0
There is an exception when the bot makes requests to CosmosDb storage. It looks like some config parameter is missed. It requires to enable cross-partition query, but the configuration of CosmosDbStorage class doesn't allow it.
Steps to reproduce the behavior:
```C#
IStorage dataStore = new CosmosDbStorage(new CosmosDbStorageOptions
{
AuthKey = "xxx",
CosmosDBEndpoint = new Uri("https://xxx.documents.azure.com:443/"),
DatabaseId = "db-test",
CollectionId = "state-collection-test"
});
// Usage in ConversationState, UserState
````
Cross partition query is required but disabled. Please set x-ms-documentdb-query-enablecrosspartition to true, specify x-ms-documentdb-partitionkey, or revise your query to avoid this exception.
ActivityId: bc813a2a-de89-4b1d-809f-82fef8e2d5da, Microsoft.Azure.Documents.Common/2.1.0.0, Windows/10.0.17134 documentdb-netcore-sdk/2.1.2
Enabling or disabling cross partition query in the CosmosDB settings (using Azure, data explorer) doesn't resolve the problem.
[bug]
I have also run into this problem. This is fairly fundamental to using CosmosDB. Furthermore this portal now says "We are planning to deprecate ability to create non-partitioned containers, as they do not allow you to scale elastically."
Would we be able to get a property to set that could enable it?
I've got a working implementation in Node with written and passing tests. I'm hoping to get to a dotnet/C# version, but I'm still new to C# and am busy working on support tickets, so somebody else might be able to implement faster than I.
Semi-related: https://github.com/Microsoft/BotBuilder/issues/5107
Is it available to use CosmosDb in 4.2 version? Or will it be fixed in 4.3?
You can use CosmosDB without partitions currently. Create the CosmosDB resource in Azure and let the bot create database and collection (the Azure Portal requires you set a partition, but the bot can make a non-partitioned collection).
Partitioning is currently slated to be supported in 4.4. See DCR: https://github.com/Microsoft/BotBuilder/issues/5107
The documentation here describes how to create the collections states that you should set the partition key as "/id" did you try that?
Also I just ran through a scenario _where I didn't have the collection created_ instead I let the run-time create the collection on the fly. I'm not sure I'd recommend this approach for CosmosDB however I wanted to check whether it was working. So it appeared to work fine, I just gave the name of the collection and did a write and read and there was no exception.
@mdrichardson example is interesting, and that would give you some notional partition behavior. However, I would have thought in many real world scenarios you would be looking to use something dynamic from the data itself rather than a statically configured key.
Anyhow I'm closing this issue now because I can't seem to reproduce that exception. Perhaps I'm doing something you're not? Anyhow if you can provide exactly the steps I can try again. One thing is I was instantiating and using the CosmosDbStorage component standalone, but that shouldn't have made any difference.
Most helpful comment
I have also run into this problem. This is fairly fundamental to using CosmosDB. Furthermore this portal now says "We are planning to deprecate ability to create non-partitioned containers, as they do not allow you to scale elastically."
Would we be able to get a property to set that could enable it?
Turns out if you create your collection up front and specify "id" as your partition key then it works fine. Probably with noting this somewhere for future reference.