azure-cosmosdb

Mongoose with CosmosDB: Getting error `Shared throughput collection should have a partition key`

a 夏天 提交于 2019-12-23 10:06:14
问题 I have a node-express application that currently uses Mongoose to connect to MongoDB, and am attempting to migrate it to Azure Cosmos DB. When I simply allow Mongoose to create the database, the application works fine, however the database is created with individual collection RU pricing. If I create a new database with Shared throughput enabled and attempt to use that, I get the error Shared throughput collection should have a partition key I have tried updating the collection schema to

How to query Azure DocumentDB with an equivalent of the SELECT DISTINCT statement

痞子三分冷 提交于 2019-12-23 09:35:11
问题 DocumentDb don't support the DISTINCT statement. I have documents in DocumentDB with the following structure (thousands of documents): { "type" : "type1", "data" : { ... } },{ "type" : "type2", "data" : { ... } },{ "type" : "type2", "data" : { ... } },{ "type" : "type2", "data" : { ... } } How can I query the collection and get the following result: { "type" : "type1" },{ "type" : "type2" } 回答1: Azure DocumentDB currently does not support DISTINCT . Please voice your opinion and vote for this

CosmosDBTrigger: Where to specify connection string?

一个人想着一个人 提交于 2019-12-23 09:06:48
问题 Using Visual Studio 2017, I created a new Azure Function app. I added a function and one of the attribute parameters is ConnectionStringSetting . That should be a reference to a setting stored somewhere, but I can't figure out where for the life of me. When I try to debug the method, this is what I get back: I have tried to put it in the local.settings.json file, no luck. I have tried to add an app.config / appSettings section and that doesn't do anything, either. I am not doing anything

In Azure Cosmos DB, can we change partition key later on once we decided at the beginning

梦想的初衷 提交于 2019-12-23 07:27:42
问题 I am new to Cosmos DB and I noticed that we can set the partition key based on needs to scale effectively through code like this: DocumentCollection myCollection = new DocumentCollection(); myCollection.Id = "coll"; myCollection.PartitionKey.Paths.Add("/deviceId"); Question is can we change the partition key later on after we created the collection and specified the partition key? As I may find out that the choice of partition key is not proper later. 回答1: Changing the partition key is not

Benefits of using Document DB after connecting with Azure Search [closed]

时间秒杀一切 提交于 2019-12-23 05:29:11
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . I'm storing the data for my in Azure Document DB. In order to allow search over the description field of my data, I've connected my document DB repository with Azure Search, as explained here: https://docs.microsoft.com/en-us/azure/documentdb/documentdb-search-indexer I also

Session Guarantee on DocumentDB

梦想与她 提交于 2019-12-23 05:26:16
问题 I am trying to understand the exact guarantees provided by DocumentDB when using session consistency. Is it possible for the following to happen (lets assume a,b,c,d are all values of the same document) Session 1 W(a) W(b) Session 2..................W(c)W(d) Session 3................................. R(b)R(c) Session 4................................ R(c)R(b) In other words, are writes across sessions ordered (in which case, either b happens before c or c happens before b, so one of C3 or C4

Using REST for CRUD operations in Azure Cosmos DB

时光怂恿深爱的人放手 提交于 2019-12-23 05:26:00
问题 I am trying do CRUD operations on Azure Cosmos DB using REST. As per the link- https://docs.microsoft.com/en-us/rest/api/documentdb/create-a-document I have created my payload and trying to test it using Restman in Opera browser. Below is my payload details- Headers Authorization *************************** Content-Type application/query+json x-ms-date Tue, 05 Dec 2017 16:49:31 GMT x-ms-session-token Session x-ms-version 2017-02-22 Body id sg4c828f-31f8-4db4-8e7c-e8bdff222dsg value { "id":

NullValueHandling setting for a class on JSON.NET by JsonConverter attribute (for Azure DocumentDb)

狂风中的少年 提交于 2019-12-23 05:15:16
问题 I have several DAO files, which are stored in Azure DocumentDb, and now I want that the null values won't be stored in the DocDb, it is possible by the [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] attribute for properties. But I don't wan't to put such attribute on every property. The problem is, there isn't any way to set the JsonSerializerSettings for the Json serializer used by the Azure DocumentDb API. The way which seems for me to go, is to use the JsonConverter attribute

cosmos db api for mongo db facing issue for some commands

大憨熊 提交于 2019-12-23 04:40:39
问题 I am using azure cosmosdb mongo api and unable to run bellow command on it. It runs fine when executed on locally hosted mongo service. Is there any way around for this? db.getCollection('requests').update( {claims: { $elemMatch: { id:1000 }}}, {$set:{"claims.$.billForMonth":"1"}} ) My data is { "_id" : NumberLong(1000), "location" : "pune", "claims" : [ { "id" : NumberLong(1000), "type" : "broadband", "billForMonth" : 4 }] } 回答1: I could reproduce the issue on my side, when I do the

Cosmos DB - Bulk Import (single partition collections) with customized partition key

一个人想着一个人 提交于 2019-12-23 04:39:04
问题 I am trying to migrate some data from a JSON file to Cosmos DB using Data Migration Tool , when I tried to define the partition key with either single or a combination of my column name, every time I am getting undefined partition key after migration, how could I correct this issue? Note here I'll have to use Bulk import (single partition collections) options, because I need to execute my customized stored procedure for nested array import, I cannot use sequential record import as I know the