azure-cosmosdb

Why Azure Documentdb creates index on each path by default

假装没事ソ 提交于 2019-12-24 10:48:16
问题 By default, documentdb creates an index on every path in a JSON. If we insert a JSON with twenty key-value pairs, documentdb will create indexes on all of these values. Whereas in SQL server, having twenty indexes on a general table is not desirable (especially on transaction tables). So why documentdb does this? Is it because it works on most of the scenarios in documentdb? If So, why? 回答1: Because DocumentDB is designed for schema and query flexibility. DocumentDB is a NoSQL database that

Spark CosmosDB Sink: org.apache.spark.sql.AnalysisException: 'write' can not be called on streaming Dataset/DataFrame

こ雲淡風輕ζ 提交于 2019-12-24 10:11:38
问题 I am reading a data stream from Event Hub in Spark (using Databricks). My goal is to be able to write the streamed data to a CosmosDB. However I get the following error: org.apache.spark.sql.AnalysisException: 'write' can not be called on streaming Dataset/DataFrame. Is this scenario not supported? Spark versions: 2.2.0 and 2.3.0 Libraries used: json-20140107 rxnetty-0.4.20 azure-documentdb-1.14.0 azure-documentdb-rx-0.9.0-rc2 azure-cosmosdb-spark_2.2.0_2.11-1.0.0 rxjava-1.3.0 azure-eventhubs

Azure CosmosDB: stored procedure delete documents based on query

时光怂恿深爱的人放手 提交于 2019-12-24 09:06:41
问题 The goal is to input a simple string query like SELECT * FROM c WHERE c.deviceId = "device1" and all resulting fetched documents need to be deleted. I have found very old posts about doing this with a stored procedure, but I can't get it to work properly with the "new" UI. Thanks a lot in advance. EDIT : I feel like @jay-gong pointed to the correct direction but I encountered a problem with his solution: I can correctly create the stored procedure but when I try to execute it it asks for the

Azure Function V2 against Cosmos Db DocumentClient

二次信任 提交于 2019-12-24 08:57:45
问题 I need to write an Azure Function that returns data against a Cosmos DB Database using Version 2 of Azure Functions. However, I am having hard time finding any good examples on how to do this. I can find very basic examples that involve search on an id. I want to be able to send the azure function some fields to query on. Such as "Likes" and "City" with in a partition and outside a partition as well. I want it to return all the all the records as json documents. Example of Cosmos DB Json

How to construct IQueryable query using Linq when I just need count without reading all documents in Document-Db database?

孤人 提交于 2019-12-24 08:34:40
问题 I need the number of documents stored in a collection in my Azure Cosmos Db database. How can I get the count using LINQ query on the IQueryable object? docDbClient.CreateDocumentQuery<TResult>().Count() If I do above, I am unable to follow it up with .AsDocumentQuery() method. 回答1: This is my async implementation (use Count, for the sync version): var count = await DocumentClient. CreateDocumentQuery<T>(CreateCollectionUri(), CreateFeedOptions()). Where(predicate). CountAsync(); where

Exception: cross partition query can not be directly served in Azure Cosmos DB query

浪子不回头ぞ 提交于 2019-12-24 07:07:01
问题 I get the following exception while making a query to Azure Cosmos DB. I am unable to understand the exact problem with this exception. It used to work earlier and I am sure that no recent changes were made to azure cosmos DB. Can anyone suggest how to proceed forward in fixing this exception. DocumentClientException: The provided by the gateway. This is a first chance (internal) exception that all newer clients will know how to handle gracefully. This exception is traced, but unless you see

Delete Documents from Cosmos using Query without Partition Key Specification

微笑、不失礼 提交于 2019-12-24 06:43:23
问题 I am trying to create a stored procedure to delete documents in Cosmos Db by using a query. Once the query returns the documents, I would like all the documents to be deleted. I tried using the script from this website but this requires putting one partition key. My Cosmos collection has a separate partition key per document so it will not work This is an example of a query I would like to run SELECT c.currentTime, c.pastTime FROM C WHERE c.currentTime < c.pastTime If that satisfies, I would

Gremlin filter by count

夙愿已清 提交于 2019-12-24 05:49:37
问题 With the usage of this query in CosmosDB Gremlin API: g.V().has('person', 'name', 'John').as('his') .out('bought').aggregate('self') .out('made_by') I have next output: [ { "id": "100", "label": "brand", "type": "vertex", "properties": { "name": [ { "id": "233b77e7-7007-4c08-8930-99b25b67e493", "value": "Apple" } ] } }, { "id": "100", "label": "brand", "type": "vertex", "properties": { "name": [ { "id": "233b77e7-7007-4c08-8930-99b25b67e493", "value": "Apple" } ] } }, { "id": "101", "label":

Gremlin filter by count

ε祈祈猫儿з 提交于 2019-12-24 05:49:12
问题 With the usage of this query in CosmosDB Gremlin API: g.V().has('person', 'name', 'John').as('his') .out('bought').aggregate('self') .out('made_by') I have next output: [ { "id": "100", "label": "brand", "type": "vertex", "properties": { "name": [ { "id": "233b77e7-7007-4c08-8930-99b25b67e493", "value": "Apple" } ] } }, { "id": "100", "label": "brand", "type": "vertex", "properties": { "name": [ { "id": "233b77e7-7007-4c08-8930-99b25b67e493", "value": "Apple" } ] } }, { "id": "101", "label":

ExecuteNextAsync Not Working

梦想的初衷 提交于 2019-12-24 05:48:22
问题 I am working with Azure DocumentDB. I am looking at the ExecuteNextAsync operation. What I am seeing is the the ExecuteNextAsync returns no resluts. I am using examples I have found on line and don't generate any results. If I call an enumeration operation on the initial query results are returned. Is there an example showing the complete configuration for using ExecuteNextAsync? Update To be more explicit I am not actually getting any results. The call seems to just run and no error is