azure-cosmosdb

Adding a new property to Cosmos DB

旧城冷巷雨未停 提交于 2019-12-11 16:49:12
问题 I've actually had quite a bit of trouble finding an answer to this question. If I create a new document in a collection, I can give it whatever properties I want. Is there a way to add a new property to all my documents? Cosmos DB seems to be resisting everything I've tried. Do I have to delete the existing documents and make new ones? It would be nice to know how to do this in C# code, if possible. Javascript is fine too, though. 回答1: CosmosDB does not support partial document updates so you

Azure Cosmos DB - CreateDatabaseAsync - Resource Not Found

☆樱花仙子☆ 提交于 2019-12-11 16:39:51
问题 I have been developing an application with Azure Cosmos DB using the Emulator with good success - I've been able to create the database & collections and add documents to the collections as well as read those documents. the trouble now is that I've tried to swap the emulator out for a live instance of Azure Cosmos DB and I am getting an error whilst trying to create the database. Microsoft.Azure.Documents.DocumentClientException: Entity with the specified id does not exist in the system. note

How update collections using Azure functions

大兔子大兔子 提交于 2019-12-11 16:05:16
问题 I want to create the azure Function which is bind to cosmos DB. Whenever some insertion happens in "A" collection I want to update "B" collection. "B" collection has stored procedure which I want to call after the insertion in collection "A". I am new to Azure and cosmos-DB. Suggest me what need to be done to accomplish the requirement. So far I have created Azure Function Also Updated the function.json with below code. { "bindings": [ { "type": "cosmosDBTrigger", "name": "input", "direction"

Developing scala spark app that connect to azure CosmosDB

筅森魡賤 提交于 2019-12-11 15:49:23
问题 Im working on developing scala spark app that connect to cosmosDB and can't resolve dependency within SBT. Whenever I include org.apache.spark it conflict with azure-cosmosdb-spark and if I take out org.apache.spark I can't get spark sparkSession to resolve. My SBT configurations : name := "MyApp" version := "1.0"`` scalaVersion := "2.11.8" libraryDependencies ++= Seq( "org.apache.spark" % "spark-core_2.11" % "2.3.0", "org.apache.spark" % "spark-sql_2.11" % "2.3.0" , "org.apache.spark" %

Cosmos db readDocument api not work in stored procedure

假装没事ソ 提交于 2019-12-11 15:41:26
问题 A simple stored procedure using readDocument function in CosmosDB/DocumentDB, but it does not work. function testRead() { var collection = getContext().getCollection(); var docId = collection.getSelfLink() + 'docs/myDocId'; // Query documents and take 1st item. var isAccepted = collection.readDocument(docId, {}, function (err, doc, options) { if (err) throw err; response.setBody(JSON.stringify(doc)); }); if (!isAccepted) throw new Error('The query was not accepted by the server.'); } it

Geospatial index querying doesn't work on Azure CosmosDB (DocumentDB) using the Mongo API

江枫思渺然 提交于 2019-12-11 14:46:09
问题 I have an Azure CosmosDB with a collection restaurants where a field geoJSON specifies the location of a restaurant in geoJSON format. I am using the MongoDB API to access this. When I log into the DB using the mongo shell, I am able to see all the documents using db.restaurants.find() . I created a 2dsphere geospatial index using db.restaurants.createIndex( {geoJSON: "2dsphere"}) . output: { "_t" : "CreateIndexesResponse", "ok" : 1, "createdCollectionAutomatically" : false, "numIndexesBefore

How to clone/copy a database in Azure Cosmos DB

旧巷老猫 提交于 2019-12-11 14:42:18
问题 How do I clone a database in Azure Cosmos DB to a mongod running on localhost:27001? I've tried the following, but I can't get it working: db.cloneDatabase("mycosmosdb:mypassword@username.documents.azure.com:10255/MyDatabase?ssl=true&replicaSet=globaldb") This returns the following when running the command from my local machine where mongod is running : { "clonedColls" : [ ], "ok" : 0, "errmsg" : "connect failed to replica set mycosmosdb:mypassword@username.documents.azure.com:10255

Error while exporting from Azure Cosmos DB to Json file using Data Migration Tool

☆樱花仙子☆ 提交于 2019-12-11 14:31:56
问题 I'm using the Microsoft Data migration tool to import from the Azure Cosmos Db container and export the content to a local JSON file. I verified the connection string and it is successfully able to make connection with the database. The query string is : SELECT * FROM ContainerName; Since I want all data. However I'm facing the following error: Edit: The sample JSON that I'm trying to export: [ { "id": "1", "SId": "101", "SName": "ABC" }, { "id": "2", "SId": "102", "SName": "XYZ" } ] I've

DocumentDB web API access with R

馋奶兔 提交于 2019-12-11 13:39:29
问题 I have the following issue when trying to connect to the documentDB web API with R and PostMan. In the DocumentDB documentation the way to ask something to the web API is to compose an Authorization header with base64 hash. In R I'm trying to compute the signature and test the header directly with postman. But I get every time a http 401. Here is my R code: toHash <- enc2utf8("get\ncolls\ndbs/toto/colls/testtoto\nsun, 08 may 2016 06:43:05 gmt\n\n") hash <- hmac(key, toHash, "sha256") base64

Azure CosmosDB Continuation Token Structure

匆匆过客 提交于 2019-12-11 13:05:24
问题 I read a lot of the documentation regarding to CosmosDB paging and thought the token should look something like this: {\"token\":\"xxxxxx\",\"range\":{\"min\":\"xxxxxxxxxx\",\"max\":\"xxxxxxxxxx\"}} But I got a token looks like this: [{\"compositeToken\":{\"token\":\"xxxxxxxxx\",\"range\":{\"min\":\"\",\"max\":\"05C1B9CD673390\"}},\"orderByItems\":[{\"item\":24}],\"rid\":\"duJVAIns+3N6AAAAAAAAAA==\",\"skipCount\":0,\"filter\":null}] I was wondering in what scenario would the token has