azure-cosmosdb

How to query sub document (list type) in Cosmos Db

試著忘記壹切 提交于 2019-12-24 00:15:13
问题 I have a collection in Azure CosmosDB, and each document looks like this: { "id": "random", "TeacherName": "Ben", "Students": [ { "Name": "John", "Telephone": "" }, { "Name": "Mary", "Telephone": "" } ], } TeacherName is string, Students is a list of student I need to do: Given a user name (user1), query and return all the documents, either teacher name is "user1" or there is a student with name "user1". I tried a few options, but cannot do it. The closest solution I found so far is to use

DocumentDb: Querying without an index

我的梦境 提交于 2019-12-23 21:48:39
问题 When excluding all paths from indexing, how come I am still able to perform a successful query on fields other than ID? Excluding all paths: collection.IndexingPolicy.ExcludedPaths.Add(new ExcludedPath() { Path = "/*" }); Query: SELECT * FROM c where c.Key = "117dfd49-a71d-413b-a9b1-841e88db06e8" Accordingly this MSDN article: When indexing is turned off, documents can be accessed only through their self-links or by queries using ID. EDIT: When looking into the indexing policy I see what my

CreateDocumentCollectionIfNotExistsAsync does not always work

安稳与你 提交于 2019-12-23 20:17:55
问题 I am trying to create a collection if it does not exist. First, I create my DocumentClient by: public DocumentClient CreateClient(ConnectionPolicy connectionPolicy = null) { return new DocumentClient(new Uri(this.AccountEndpoint), this.AccountKey, connectionPolicy); } Now that I have my document client (let's call it documentDbClient ), I attempt to use CreateDocumentCollectionIfNotExistsAsync : var documentDbClient = dbConnection.CreateClient(); await documentDbClient

PartitionKey value must be supplied for this operation

◇◆丶佛笑我妖孽 提交于 2019-12-23 17:17:56
问题 I am trying to retrieve a document from the Azure Cosmos Db Collection. I am running into an error Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.UnsupportedOperationException: PartitionKey value must be supplied for this operation.] with root cause java.lang.UnsupportedOperationException: PartitionKey value must be supplied for this operation. I was trying to look up online how can I provide

DocumentDB - WHERE clause within collection

一个人想着一个人 提交于 2019-12-23 16:36:48
问题 Given a sample document like this one from the Microsoft examples: { "id": "AndersenFamily", "lastName": "Andersen", "parents": [ { "firstName": "Thomas" }, { "firstName": "Mary Kay"} ], "children": [ { "firstName": "Henriette Thaulow", "gender": "female", "grade": 5, "pets": [{ "givenName": "Fluffy" }] } ], "address": { "state": "WA", "county": "King", "city": "seattle" }, "creationDate": 1431620472, "isRegistered": true } We can see that there is a sub-collection children containing an

Mocking IDocumentQuery in Unit Test that uses SQL Queries

强颜欢笑 提交于 2019-12-23 13:01:41
问题 I am using unit tests to test DocumentDBRepository class. I followed this post as an example for the SQL queries use case. But it shows error of Message: System.InvalidCastException : Unable to cast object of type 'System.Linq.EnumerableQuery to type 'Microsoft.Azure.Documents.Linq.IDocumentQuery Here's my code for DocumentDBRepository class private IDocumentQuery<T> GetQueryBySQL(string queryStr) { var uri = UriFactory.CreateDocumentCollectionUri(_databaseId, _collectionId); var feedOptions

DocumentDB: Performance impact of built-in string functions (like UPPER)

蹲街弑〆低调 提交于 2019-12-23 12:23:55
问题 In our .NET application we use the DocumentDB SDK to query our Azure DocumentDB. We were trying to find the cause of a performance problem when we realized that the built-in string functions in queries seems to have a big impact on performance. I was going to paste some stats that I got from our application but I've been able to replicate the situation with the playground here: https://www.documentdb.com/sql/demo (click on the sandbox tab) With the following query: SELECT * FROM food WHERE

how to select from collection with guid id?

谁说我不能喝 提交于 2019-12-23 12:10:06
问题 I've got this collection with guid id. When i use Azure Query Explorer with collection selected in the combo box above it's ok: SELECT * FROM c But when i try to select it like that (both from query exlorer and from c# code): SELECT * FROM 357fa002-dc7d-4ede-935a-6a0c80cf9239 c I get: Syntax error, invalid numeric value token '357fa002'. I've tried to put it in quotation marks (both single and double) around guid but with no success.. Microsoft docs state that this collection id doesn't break

Where did RU/m go?

醉酒当歌 提交于 2019-12-23 11:35:37
问题 This used to be a feature of CosmosDb to provision Request Units Per Minute (as well as Request Units Per Second) however the option appears to have disappeared from the portal and all online documentation has been removed? Thanks, Oliver 回答1: RU/m is dead Just received a response from Microsoft We received a ton of feedback from our customers who participated in the Preview program; starting 8/25/2017, we have officially closed the Preview program for RU/M. Based on all customer feedback, we

Where did RU/m go?

二次信任 提交于 2019-12-23 11:35:09
问题 This used to be a feature of CosmosDb to provision Request Units Per Minute (as well as Request Units Per Second) however the option appears to have disappeared from the portal and all online documentation has been removed? Thanks, Oliver 回答1: RU/m is dead Just received a response from Microsoft We received a ton of feedback from our customers who participated in the Preview program; starting 8/25/2017, we have officially closed the Preview program for RU/M. Based on all customer feedback, we