Skip to content

Commit bf80dc6

Browse files
Code sample comments
1 parent f18b58f commit bf80dc6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

articles/cosmos-db/sql/migrate-containers-partitioned-to-nonpartitioned.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ static class Family {
133133
CosmosDatabase cosmosDatabase = cosmosClient.getDatabase("testdb");
134134
CosmosContainer cosmosContainer = cosmosDatabase.getContainer("testcontainer");
135135

136-
136+
// Create single item
137137
Family family = new Family("id-1", "John", "Doe", "Doe");
138138
cosmosContainer.createItem(family, new PartitionKey(family._partitionKey), new CosmosItemRequestOptions());
139139

140+
// Create items through bulk operations
140141
family = new Family("id-2", "Jane", "Doe", "Doe");
141142
CosmosItemOperation createItemOperation = CosmosBulkOperations.getCreateItemOperation(family,
142143
new PartitionKey(family._partitionKey));
@@ -154,11 +155,14 @@ While the container definition is enhanced with a partition key property, the do
154155
Applications can access the existing documents that dont have a partition key by using the special system property called "PartitionKey.None", this is the value of the non-migrated documents. You can use this property in all the CRUD and query operations. The following example shows a sample to read a single Document from the NonePartitionKey.
155156

156157
```java
157-
CosmosItemResponse<JsonNode> cosmosItemResponse = cosmosContainer.readItem("itemId", PartitionKey.NONE, JsonNode.class);
158+
CosmosItemResponse<JsonNode> cosmosItemResponse =
159+
cosmosContainer.readItem("itemId", PartitionKey.NONE, JsonNode.class);
158160
```
159161

160162
For the complete sample on how to repartition the documents, see the [Java samples][2] GitHub repository.
161163

164+
---
165+
162166
## Compatibility with SDKs
163167

164168
Older version of Azure Cosmos DB SDKs such as V2.x.x and V1.x.x dont support the system defined partition key property. So, when you read the container definition from an older SDK, it doesnt contain any partition key definition and these containers will behave exactly as before. Applications that are built with the older version of SDKs continue to work with non-partitioned as is without any changes.

0 commit comments

Comments
 (0)