azure-cosmosdb

Attempting to connect to azure database has suddenly stopped working, throwing exceptions

大憨熊 提交于 2019-12-23 02:04:21
问题 I have the following code running in an Azure Function (V2); new DocumentClient(new Uri(keys.dbEndPoint), keys.dbPrimaryKey); Which has worked fine running in azure functions on localhost until today, without changing anything I'm now getting the following exception: Data [IDictionary]:{System.Collections.ListDictionaryInternal} HResult [int]:-2146233036 HelpLink [string]:null InnerException [Exception]:{System.NullReferenceException: Object reference not set to an instance of an object.}

Am I being overcharged by Azure Cosmo DB for 45MB database?

蹲街弑〆低调 提交于 2019-12-22 17:46:24
问题 We use Cosmo DB as "MongoDB" , We have a database that is only 45MB in size, less than 10,000 documents across all collections. We run light queries and writes each day, less than 3000 requests/day, also we run “MongoDB Dump” each night to dump the entire database to local server for backup, as said, the downloaded file is only around 45 MB, so I presume it is not too big. In Feb 2018, we received a bill which is around £3,500 which is surprisingly ridiculous. it looks like we were being

Azure Function CosmosDBTrigger unscaleable

风流意气都作罢 提交于 2019-12-22 10:29:59
问题 I have a Azure Function with a CosmosDBTrigger working on a consumption play monitored with Application Insights. The collection being monitored has 500,000 inserts in the change feed. The consumption plan scales up the number of instances to 15 within a few minutes but only the first instance is able to process any changes. I assume this is because of the lease is kept by the first instance. I am essentially paying for 14 instances to do nothing. I noticed you are supposed to be able to set

Stored procedure azure Cosmos DB returns empty collection

萝らか妹 提交于 2019-12-22 09:57:18
问题 I tried to create a stored procedure using the sample sp creation code from Azure docs, but i couldn't fetch the collection details. It always returns null. Stored Procedure // SAMPLE STORED PROCEDURE function sample(prefix) { var collection = getContext().getCollection(); console.log(JSON.stringify(collection)); // Query documents and take 1st item. var isAccepted = collection.queryDocuments( collection.getSelfLink(), 'SELECT * FROM root r', function (err, feed, options) { if (err) throw err

How to insert into documentDB from Excel file containing 5000 records?

孤者浪人 提交于 2019-12-22 09:46:47
问题 I have an Excel file that originally had about 200 rows, and I was able to convert the excel file to a data table and everything got inserted into the documentdb correctly. The Excel file now has 5000 rows and it is not inserting after 30-40 records insertion and rest of all the rows are not inserted into the documentdb I found some exception as below. Microsoft.Azure.Documents.DocumentClientException: Exception: Microsoft.Azure.Documents.RequestRateTooLargeException, message: {"Errors":[

Cosmos DB - Insert Multiple Records with Python

浪子不回头ぞ 提交于 2019-12-22 08:33:47
问题 In Cosmos DB I can (thanks to the SO Community) insert a document like so: data = {'attribute1':1, 'attribute2': 2} client.CreateDocument('dbs/databaseName/colls/collectionName/', data) It would be great if I could insert multiple documents at a time, like how in SQL you can do: insert into table values (1, 2), (3,4), (5,6) I understand that you can do bulk uploads with stored procedures, but if I could basically concat a bunch of documents together I think that would work better for me (..

How to create a unique index with documentDB

三世轮回 提交于 2019-12-22 06:57:47
问题 Im coming from using mongoDB so will use this as an example, in it I can do something like. collection.ensureIndex('id', {unique: true, dropDups: true }); And then whenever I try to insert data with the same id, I will get a duplicate key error and it wont work. great! But can a similar thing be done with documentDB? Currently I have the following code written with node.js to insert data: client.createDocument(collection_id, data_to_insert, function (err, doc) { callback(err, doc); }); 回答1:

CosmosDB stored procedures - promise instead of callback

女生的网名这么多〃 提交于 2019-12-22 06:51:14
问题 Is it possible to use javascript promises instead of regular callbacks within CosmosDB (DocumentDB) stored procedure API calls? An usage would be implementing pagination. For example token = getToken(); doSomething(token); //.... function getToken(....) { //... collection.queryDocuments(link, query, queryOptions, function(error, documents, responseOptions) { return responseOptions.continuation; }); } would not work because the token is returned within a callback, and the execution continues.

Azure Function & Document DB

。_饼干妹妹 提交于 2019-12-22 06:18:23
问题 I'm curious how the scaling working on the Azure Functions with relation to outputting to Document DB. Basically what happens when Document DB returns a 429 because I'm exceeded my allocated throughput? I ask because when I had the lowest level of Azure Functions combined with the lowest level of Document DB and proceeded to call the function 1000 times in 20 sec I was only seeing 700-800 actual documents inserted into my document db collection. When I scaled Document DB up to the max with

DocumentDB call stored procedure from another stored procedure or itself

时光毁灭记忆、已成空白 提交于 2019-12-22 05:36:35
问题 Is there a way to recursively call stored procedures (or even UDFs if that will work) against DocumentDB documents? We have a document that looks something like this: { "docID" : "my_id", "owner" : "fred", "items" : [ { "itemID" : "1", "type" : "item", "value" : 3 }, { "itemID" : "2", "type" : "group", "items" : [ { "itemID" : "2.1", "type" : "group", "items" : [ { "itemID" : "2.1.1", "type" : "item", "value" : 2 }, { "itemID" : "2.1.2", "type" : "item", "value" : 4 } ] }, { "itemID" : "2.2",