azure-cosmosdb

Document DB - ST_DISTANCE

浪子不回头ぞ 提交于 2020-01-14 03:31:06
问题 Would a query like SELECT TOP 1 * ST_DISTANCE etc or more specifically SELECT TOP 1 * FROM c WHERE ST_DISTANCE(c.AssetLocation, { 'type': 'Point', 'coordinates': [115.58, 21.84] }) < 49999 return the closest object, and if not, how could I order by distance? Thanks, Ian 回答1: DocumentDB does not natively support nearest or ORDER BY using Geo-Spatial index yet. The best approach for ORDER BY is to project ( SELECT ) the distance in the query and sort it either client-side or via a stored

IDocumentClient.UpsertDocumentAsync doesn't update, it inserts duplicated ids

谁说我不能喝 提交于 2020-01-13 20:26:13
问题 I have a VS2017 solution in C#, and I'm using IDocumentClient.UpsertDocumentAsync to Upsert some documents into my cosmosdb documentdb collection. But I noticed it's actually creating new documents with the same id while there already is a document in the collection with that id. Now after upserting a new document with the same id the query result looks something like this: select * from c where c.id = "aaaa-bbbb-cccc" [ { "id": "aaaa-bbbb-cccc", "firstname": "john", "lastname": "doe" }, {

How to query embedded data documentDB to retrieve parent document

怎甘沉沦 提交于 2020-01-13 07:21:32
问题 In DocumentDb, is it possible to search for child documents to get the parent documents? public class Customer { [JsonProperty(PropertyName = "id")] public string Id { get; set; } [JsonProperty(PropertyName = "name")] public string Name { get; set; } [JsonProperty(PropertyName = "locations")] public List<Location> Locations { get; set; } public Customer() { Locations = new List<Location>(); } } public class Location { [JsonProperty(PropertyName = "id")] public string Id { get; set; }

How to query embedded data documentDB to retrieve parent document

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-13 07:21:28
问题 In DocumentDb, is it possible to search for child documents to get the parent documents? public class Customer { [JsonProperty(PropertyName = "id")] public string Id { get; set; } [JsonProperty(PropertyName = "name")] public string Name { get; set; } [JsonProperty(PropertyName = "locations")] public List<Location> Locations { get; set; } public Customer() { Locations = new List<Location>(); } } public class Location { [JsonProperty(PropertyName = "id")] public string Id { get; set; }

DocumentDB IN keyword with Linq

无人久伴 提交于 2020-01-13 00:30:55
问题 You can now create IN queries with DocumentDB like this: SELECT * FROM Families WHERE Families.id IN ('AndersenFamily', 'WakefieldFamily') But if I run a similar query with Linq I get an error {"Method 'Contains' is not supported."} .where(a => familyNames.Contains(a.Families)) How can I crate IN queries with Linq? 回答1: IN is not currently supported by the LINQ provider. We will fix this in a future SDK update. 回答2: This is fixed now, what you have should work with the new SDK releases. 来源:

Error connecting to Azure: Illegal character in password with mongoose 5.0.1 but works in 4.13.9

狂风中的少年 提交于 2020-01-12 07:14:18
问题 I have a node.js application that is deployed to azure using CosmosDB and the MongoDB API. My application uses mongoose which works seamlessly in 4.13.9. My application that works connects as follows: var configDB = require('./config/database'); var mongoose = require('mongoose'); mongoose.connect(configDB.url, { useMongoClient: true } ); mongoose.Promise = global.Promise; var db = mongoose.connection; db.on('error', console.error.bind(console, 'MongoDB connection error:')); the config

Schema Migration Scripts in NoSQL Databases

五迷三道 提交于 2020-01-12 03:26:50
问题 I have a active project that has always used C#, Entity Framework, and SQL Server. However, with the feasibility of NoSQL alternatives daily increasing, I am researching all the implications of switching the project to use MongoDB. It is obvious that the major transition hurdles would be due to being "schema-less". A good summary of what that implies for languages like C# is found here in the official MongoDB documentation. Here are the most helpful relevant paragraphs (bold added): Just

What does it mean that Azure Cosmos DB is multi-model?

谁说胖子不能爱 提交于 2020-01-11 21:31:41
问题 Looking at the new Azure cosmos database, I'm a bit confused about the multi-model nature of it. Specifically, does it mean: a) That the same underlying database/store can be queried multiple ways concurrently so that I can use both gremlin graph queries and mongodb api against the same collections. or - b) Does it mean that you can choose a different model (graph, key value, column, document) at the time of provisioning your Cosmos DB and that is how the data will be stored from then on. The

How to use SQL Query with hyphen in Collection name?

拜拜、爱过 提交于 2020-01-11 09:53:22
问题 Does anyone know how to use a SQL query on a CosmosDB Collection that has a hyphen in the name? For example SELECT * FROM product-group where product-group.id = "3829503" I've see that properties can be accessed using the [""] syntax but haven't seen any solutions for the actual collection name. 回答1: When you query via DocumentDB SQL, you don't need to specify the exact collection name; you're really specifying an alias in your query. In the Query Explorer (via the portal), all queries are

How to use SQL Query with hyphen in Collection name?

你离开我真会死。 提交于 2020-01-11 09:52:31
问题 Does anyone know how to use a SQL query on a CosmosDB Collection that has a hyphen in the name? For example SELECT * FROM product-group where product-group.id = "3829503" I've see that properties can be accessed using the [""] syntax but haven't seen any solutions for the actual collection name. 回答1: When you query via DocumentDB SQL, you don't need to specify the exact collection name; you're really specifying an alias in your query. In the Query Explorer (via the portal), all queries are