azure-cosmosdb-sqlapi

Why am I seeing different index behaviour between 2 seemingly identical CosmosDb Collections

ε祈祈猫儿з 提交于 2019-12-21 16:22:15
问题 I'm trying to debug a very strange discrepency between 2 seperate cosmos db collection that on face value are configured the same. We recently modified some code that executed the following query. OLD QUERY SELECT * FROM c WHERE c.ProductId = "CODE" AND c.PartitionKey = "Manufacturer-GUID" NEW QUERY SELECT * FROM c WHERE (c.ProductId = "CODE" OR ARRAY_CONTAINS(c.ProductIdentifiers, "CODE")) AND c.PartitionKey = "Manufacturer-GUID" The introduction of that Array_Contains call in the production

Cosmos Db Throughput

岁酱吖の 提交于 2019-12-20 02:08:21
问题 Is there any option to retrieve Cosmos DB (SQL API) throughput programmatically. I'm using the below code to get the list of DB DocumentClient client = new DocumentClient(ClientURL, ClientKey,); var databaseList = client.CreateDatabaseQuery().ToList(); Next I wanted to know the throughput for each of the database. Please let me know if this is feasible 回答1: You could refer to CreateOfferQuery method to get throughout settings of Database or Collections. Also,please refer to this rest api

How to find duplicates in a nested array in cosmos db without GROUP BY and COUNT

空扰寡人 提交于 2019-12-18 09:33:52
问题 I am trying to find duplicates in a nested object in a collection. In ye olde SQL, I would do this with some sort of GROUP BY and a COUNT. Cosmos DB doesn't support GROUP BY (as far as I can see) so I am trying to find a work around. One limitation is that I only have access to the data explorer in the azure portal (Don't ask). To explain in more detail, suppose you have a collection like the following. Note that the first item has a duplicate in the "stuff" collection: [ { "id": "1", "Name":

The remote server returned an error: (403) Forbidden. At C:\Program Files\WindowsPowerShell\Modules\CosmosDB\3.1.0.293\CosmosDB.psm1

吃可爱长大的小学妹 提交于 2019-12-13 09:25:31
问题 I developed the PowerShell script for creating Database and Collection in the Azure Cosmos DB. #region Parameters $connectionString='XXXXXXXXXXXXXXXXX==' $accountName='demo-account-01' $databaseName='demo-db-01' $collectionName='demo-collection-01' #endregion #region Login into Azure using Interactive Mode # sign in Write-Host "Logging in..."; Connect-AzAccount #Set the current azure subscription Select-AzSubscription -subscription 'Visual Studio Ultimate with MSDN' #endregion #region Create

Cosmos DB - Partition key for fixed collections

时光总嘲笑我的痴心妄想 提交于 2019-12-13 07:51:46
问题 Can someone advise how to create Fixed collection (throughput - 400 RU) with logical partition keys? Is it possible? It is necessary for me in order to migrate easily to unlimited collection in the future. Thanks. 回答1: You cannot create a fixed collection with a partition key. Also once a collection is created without a partition key, it cannot be converted to a partitioned one without being migrated form one collection to another. 来源: https://stackoverflow.com/questions/53471683/cosmos-db

ExecuteNextAsync freezes/hangs in Azure Cosmos DB [duplicate]

人盡茶涼 提交于 2019-12-13 04:40:59
问题 This question already has answers here : An async/await example that causes a deadlock (5 answers) Closed 11 months ago . When you create a new cosmos DB some code samples are shown in Azure. Most of the code works. However I have this single function that just freezes/hangs when Executed. Any ideas how to solve or troubleshoot? Code: public async Task<IEnumerable<T>> GetItemsAsync(Expression<Func<T, bool>> predicate, string collection) { IDocumentQuery<T> query = Client.CreateDocumentQuery<T

Return the content of a specific object in an array — CosmosDB

淺唱寂寞╮ 提交于 2019-12-13 04:26:34
问题 This is a follow up to question 56126817 My current query SELECT c.EventType.EndDeviceEventDetail FROM c WHERE c.EventType.EndDeviceEventType.eventOrAction = '93' AND c.EventType.EndDeviceEventType.subdomain = '137' AND c.EventType.EndDeviceEventType.domain = '26' AND c.EventType.EndDeviceEventType.type = '3' AND ARRAY_CONTAINS(c.EventType.EndDeviceEventDetail,{"name": "RCDSwitchReleased","value": "true" }) My Query Output [ { "EndDeviceEventDetail": [ { "name": "Spontaneous", "value": "true"

cosmosdb sql api vs mongodb api which one to use for my scenario.

梦想与她 提交于 2019-12-13 01:18:49
问题 I have a document called "chat" "Chat": [ { "User": {}, "Message": "i have a question", "Time": "06:55 PM" }, { "User": {}, "Message": "will you be able to ", "Time": "06:25 PM" }, { "User": {}, "Message": "ok i will do that", "Time": "07:01 PM" } every time a new chat message arrives i should be able to simple append to this array. mongodb API aggregation pipeline (preview) allows me to use things like $push $addToSet for that if i use sql api i will have to pull the entire document every

cosmosdb emulator not giving any results

﹥>﹥吖頭↗ 提交于 2019-12-12 12:26:43
问题 I have no idea why this happening while querying the cosmos database it won't show any document not even for the SELECT * FROM c but the RU's is shown. but it works fine with the Documents tab in documents tab if I'm using any filter then also it working but it won't work for SQL query. I have added the screenshot for both the case and also the scale & setting. Do I need to reinstall the azure cosmosdb emulator? if yes then, is there any way to retain my old data of emulator 回答1: This looks

Azure Cosomos DB stored procedure response size too large

安稳与你 提交于 2019-12-11 19:49:28
问题 I have Sensor IoT Data which is getting stored in cosmos DB . I need minute level aggregation of data for last 30 days to show in webapp. So i have written stored procedure for it to do group by and aggregations of sensors data. it is giving following error Failed to execute stored procedure something for collection newData: {"code":400,"body":"{\"code\":\"BadRequest\",\"message\":\"Message: {\\"Errors\\":[\\"Encountered exception while executing function. Exception = Error: Resulting message