简体   繁体   中英

How to create single partitioned collection in Cosmos DB using Azure portal

I'm working with Azure Cosmos DB, and I need to fetch all the documents of a particular collection of database. So that for executing a stored procedure they ask to enter partition key value, but I need the query result without any filter.

How can I create a collection for a particular database without mentioning the partition key? I'm accessing Cosmos DB in https://portal.azure.com/ . I have to create a collection from that UI itself, not from code.

Firstly,about stored procedure execution needs partition key.You could find the below clear statements in the link :

If a stored procedure is associated with an Azure Cosmos container, then the stored procedure is executed in the transaction scope of a logical partition key. Each stored procedure execution must include a logical partition key value that corresponds to the scope of the transaction. For more information, see Azure Cosmos DB partitioning article.

Secondly,in the past,you could create non-partitioned collection on the portal.But now, you can't.Please see my previous case: Is it still a good idea to create comos db collection without partition key? . Based on your description,you don't want partitioned collection.So, please create non-partitioned collection by Cosmos DB SDK. Such as:

DocumentCollection collection = new DocumentCollection();
collection.set("id","jay");
ResourceResponse<DocumentCollection> createColl = client.createCollection("dbs/db",collection,null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM