azure-cosmosdb

Get document size in Cosmos DB

三世轮回 提交于 2019-12-12 13:30:28
问题 How can I get or figure out the size of a document stored in Cosmos DB? Is this something already stored within document? 回答1: If you get (or query) a document, you can then look at the headers that come back, specifically x-ms-resource-usage , which will contain a documentsSize attribute (representing a document's size in kb). In node/javascript, you'd make a call that looks something like: client.readDocument(docLink, function (err, doc, headers) { ... }) You'd want to look at headers['x-ms

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

Can't register CosmosDB binding extension in Azure Functions V2

独自空忆成欢 提交于 2019-12-12 12:26:30
问题 I'm trying to add a new function(Http Trigger) with CosmosDB input binding. Reading a manual about input bindings in Azure Functions Version 2 I see that I need to register my binging extension(https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#register-binding-extensions), and azure portal should show me some prompt for registration(https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#azure-portal-development) I'm confused,

Handling Request Units per Second (RUs/s) Spikes in DocumentDB

霸气de小男生 提交于 2019-12-12 12:22:17
问题 One of the most difficult things with DocumentDB is figuring out how many Request Units per Second (RUs/s) you need to run your application day to day but also during usage spikes. When you get this wrong, the DocumentDB client will throw exceptions, which is a terrible usage model. If my application has particular times of the day where it would use a higher number of Request Units per Second (RUs/s), then how do I handle this in DocumentDB? I don't want to set a really high RUs/s all day

“'SELECT *' is only valid with a single input set.”

空扰寡人 提交于 2019-12-12 10:47:46
问题 Trying to learn the query syntax in the sandbox ( https://www.documentdb.com/sql/demo ) SELECT food.id FROM food JOIN t in food.tags WHERE t.name = "oil" This works, but what if I want to get the entire document, so I tried SELECT food.* FROM food JOIN t in food.tags WHERE t.name = "oil" and SELECT * FROM food JOIN t in food.tags WHERE t.name = "oil" and get the error: { "errors": [ { "severity": "Error", "location": { "start": 7, "end": 8 }, "code": "SC2040", "message": "'SELECT *' is only

Does the Azure DocumentDB Local Emulator support the mongodb protocol?

痴心易碎 提交于 2019-12-12 10:12:33
问题 Does the Azure DocumentDB Local Emulator support the mongodb protocol similar to the MongoDB protocol available in the Azure hosted DocumentDB? I don't see a way to specify the protocol when starting up the local emulator. 回答1: Yes, the Azure DocumentDB emulator supports MongoDB API. It listens by default on port 10250. See how you can connect to the emulator from MongoDB apps here: https://docs.microsoft.com/en-us/azure/documentdb/documentdb-nosql-local-emulator#developing-with-the

Getting “A task was cancelled” while trying to create a document in DocumentDB

对着背影说爱祢 提交于 2019-12-12 09:37:00
问题 When I try to create a document in my DocumentDB database using the following code, the code hangs where I call CreateDocumentAsync() and eventually gives me "A task was cancelled" error. Any idea why? public static async Task<Employee> CreateEmployee(Employee emp) { try { using (client = new DocumentClient(new Uri(endPointUrl), authorizationKey)) { //Get the database var database = await GetDatabaseAsync(); //Get the Document Collection var collection = await GetCollectionAsync(database

DocumentDB Change Feed - How to see all changes to a document

给你一囗甜甜゛ 提交于 2019-12-12 08:48:31
问题 This new Change Feed feature provided by DocumentDB is pretty cool. However, the documentation states: Each change to a document appears only once in the change feed. Only the most recent change for a given document is included in the change log. Intermediate changes may not be available. Basically, if a document goes from revision A->B->C, when the change feed is polled, we're only going to get "C." - I have a situation where I want to see "A" and "B" as well. I know of a few existing

CosmosDB - Correct Partition Key

久未见 提交于 2019-12-12 05:43:09
问题 Every JSON file I upload to the collection is in the following format: { "Blocks": [ { "radarID": "51p01", ... }, { "radarID": "51p02", ... } ] } The partition key I use is '/Blocks/radarID', but it does not work. I guess radarID is not an immediate child of Blocks, it is in a list. So do you know what I should write as my partition key? Thanks. 回答1: Partition Key has to be a single value for each document, it can't be a field in sub-array. Partition Key is used to determine which database

Is there having clause in azure cosmos db? How to use it?

▼魔方 西西 提交于 2019-12-12 05:39:45
问题 I was trying to write a query which is finding MAX value from all documents. The scenario is something like I have 100 Students Documents, in which student Name, roll number as well as array of Tests inside that array of Subject and its respective marks. So, I am getting highest marks among subject physics from all documents. But I am not getting it with student roll number. That I was trying to find out. TestDoc is: Student[ StudenName:"A", StudentRollNo :1, id:"1", StudentAdd:"---", Test1:[