You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where the first parameter is a distinct name that describes the goal of this processor and the second name is the delegate implementation that will handle changes.
Finally you define a name for this processor instance with `WithInstanceName` and which is the container to maintain the lease state with `WithLeaseContainer`.
Copy file name to clipboardExpand all lines: articles/cosmos-db/create-sql-api-dotnet-v4.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,64 +145,64 @@ To learn in more about the hierarchy of different entities, see the [working wit
145
145
146
146
The sample code described in this article creates a family database in Azure Cosmos DB. The family database contains family details such as name, address, location, the associated parents, children, and pets. Before populating the data to your Azure Cosmos account, define the properties of a family item. Create a new class named `Family.cs` at the root level of your sample application and add the following code to it:
Add the following global variables in your `Program` class. These will include the endpoint and authorization keys, the name of the database, and container that you will create. Make sure to replace the endpoint and authorization keys values according to your environment.
Create a family item by adding the `AddItemsToContainerAsync` method with the following code. You can use the `CreateItemAsync` or `UpsertItemAsync` methods to create an item:
After inserting an item, you can run a query to get the details of "Andersen" family. The following code shows how to execute the query using the SQL query directly. The SQL query to get the "Anderson" family details is: `SELECT * FROM c WHERE c.LastName = 'Andersen'`. Define the `QueryItemsAsync` method within the `Program` class and add the following code to it:
Copy file name to clipboardExpand all lines: articles/cosmos-db/create-sql-api-java.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,55 +80,55 @@ This step is optional. If you're interested in learning how the database resourc
80
80
81
81
*`CosmosClient` initialization. The `CosmosClient` provides client-side logical representation for the Azure Cosmos database service. This client is used to configure and execute requests against the service.
### Managing database resources using the asynchronous (async) API
106
106
107
107
* Async API calls return immediately, without waiting for a response from the server. In light of this, the following code snippets show proper design patterns for accomplishing all of the preceding management tasks using async API.
108
108
109
109
*`CosmosAsyncClient` initialization. The `CosmosAsyncClient` provides client-side logical representation for the Azure Cosmos database service. This client is used to configure and execute asynchronous requests against the service.
* As with the sync API, item creation is accomplished using the `createItem` method. This example shows how to efficiently issue numerous async `createItem` requests by subscribing to a Reactive Stream which issues the requests and prints notifications. Since this simple example runs to completion and terminates, `CountDownLatch` instances are used to ensure the program does not terminate during item creation. **The proper asynchronous programming practice is not to block on async calls - in realistic use-cases requests are generated from a main() loop that executes indefinitely, eliminating the need to latch on async calls.**
Copy file name to clipboardExpand all lines: articles/cosmos-db/create-sql-api-python.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,26 +120,27 @@ The following snippets are all taken from the *cosmos_get_started.py* file.
120
120
121
121
* The CosmosClient is initialized. Make sure to update the "endpoint" and "key" values as described in the [Update your connection string](#update-your-connection-string) section.
* A new container is created, with 400 RU/s of [provisioned throughput](request-units.md). We choose `lastName` as the [partition key](partitioning-overview.md#choose-partitionkey), which allows us to do efficient queries that filter on this property.
* Some items are added to the container. Containers are a collection of items (JSON documents) that can have varied schema. The helper methods ```get_[name]_family_item``` return representations of a family that are stored in Azure Cosmos DB as JSON documents.
* A query is performed using SQL query syntax. Because we're using partition key values of ```lastName```in the WHERE clause, Azure Cosmos DB will efficiently route this query to the relevant partitions, improving performance.
Copy file name to clipboardExpand all lines: articles/cosmos-db/create-sql-api-xamarin-dotnet.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ Now let's take a quick review of how the app communicates with Azure Cosmos DB.
123
123
124
124
* When querying a container fordocuments, the `DocumentClient.CreateDocumentQuery<T>` method is used, as seen herein the `CosmosDBService.GetToDoItems` function:
The `CreateDocumentQuery<T>` takes a URI that points to the container created in the previous section. And you are also able to specify LINQ operators such as a `Where` clause. In this case only todo items that are not completed are returned.
129
129
@@ -136,21 +136,21 @@ Now let's take a quick review of how the app communicates with Azure Cosmos DB.
136
136
137
137
* The `ComsmosDBService.InsertToDoItem`functiondemonstrates how to insert a new document:
Here a new URI is needed to uniquely identify the document to replace and is obtained by using `UriFactory.CreateDocumentUri` and passing it the database and container names and the ID of the document.
148
148
149
149
The `DocumentClient.ReplaceDocumentAsync` replaces the document identified by the URI with the one specified as a parameter.
150
150
151
151
* Deleting an item is demonstrated with the `CosmosDBService.DeleteToDoItem` function:
Copy file name to clipboardExpand all lines: articles/cosmos-db/how-to-configure-change-feed-start-time.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,15 +20,15 @@ When a change feed processor starts the first time, it will initialize the lease
20
20
21
21
It's possible to initialize the change feed processor to read changes starting at a **specific date and time**, by passing an instance of a `DateTime` to the `WithStartTime` builder extension:
The change feed processor will be initialized for that specific date and time and start reading the changes that happened after.
26
26
27
27
## Reading from the beginning
28
28
29
29
In other scenarios like data migrations or analyzing the entire history of a container, we need to read the change feed from **the beginning of that container's lifetime**. To do that, we can use `WithStartTime` on the builder extension, but passing `DateTime.MinValue.ToUniversalTime()`, which would generate the UTC representation of the minimum `DateTime` value, like so:
0 commit comments