Skip to content

Commit 8e4c332

Browse files
committed
Adding tabs
1 parent 613292e commit 8e4c332

File tree

1 file changed

+39
-18
lines changed

1 file changed

+39
-18
lines changed

articles/cosmos-db/how-to-manage-conflicts.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ With multi-region writes, when multiple clients write to the same item, conflict
1616

1717
These samples show how to set up a container with a last-writer-wins conflict resolution policy. The default path for last-writer-wins is the timestamp field or the `_ts` property. For SQL API, this may also be set to a user-defined path with a numeric type. In a conflict, the highest value wins. If the path isn't set or it's invalid, it defaults to `_ts`. Conflicts resolved with this policy do not show up in the conflict feed. This policy can be used by all APIs.
1818

19-
### <a id="create-custom-conflict-resolution-policy-lww-dotnet"></a>.NET SDK V2
19+
### <a id="create-custom-conflict-resolution-policy-lww-dotnet"></a>.NET SDK
20+
21+
# [.NET SDK V2](#tab/dotnetv2)
2022

2123
```csharp
2224
DocumentCollection lwwCollection = await createClient.CreateDocumentCollectionIfNotExistsAsync(
@@ -31,7 +33,7 @@ DocumentCollection lwwCollection = await createClient.CreateDocumentCollectionIf
3133
});
3234
```
3335

34-
### <a id="create-custom-conflict-resolution-policy-lww-dotnet-v3"></a>.NET SDK V3
36+
# [.NET SDK V3](#tab/dotnetv3)
3537

3638
```csharp
3739
Container container = await createClient.GetDatabase(this.databaseName)
@@ -44,8 +46,11 @@ Container container = await createClient.GetDatabase(this.databaseName)
4446
}
4547
});
4648
```
49+
---
50+
51+
### <a id="create-custom-conflict-resolution-policy-lww-java"></a>Java SDK
4752

48-
### <a id="create-custom-conflict-resolution-policy-lww-java-async"></a>Java Async SDK
53+
# [Java Async SDK](#tab/javaasync)
4954

5055
```java
5156
DocumentCollection collection = new DocumentCollection();
@@ -55,7 +60,7 @@ collection.setConflictResolutionPolicy(policy);
5560
DocumentCollection createdCollection = client.createCollection(databaseUri, collection, null).toBlocking().value();
5661
```
5762

58-
### <a id="create-custom-conflict-resolution-policy-lww-java-sync"></a>Java Sync SDK
63+
# [Java sync SDK](#tab/javasync)
5964

6065
```java
6166
DocumentCollection lwwCollection = new DocumentCollection();
@@ -64,6 +69,7 @@ ConflictResolutionPolicy lwwPolicy = ConflictResolutionPolicy.createLastWriterWi
6469
lwwCollection.setConflictResolutionPolicy(lwwPolicy);
6570
DocumentCollection createdCollection = this.tryCreateDocumentCollection(createClient, database, lwwCollection);
6671
```
72+
---
6773

6874
### <a id="create-custom-conflict-resolution-policy-lww-javascript"></a>Node.js/JavaScript/TypeScript SDK
6975

@@ -166,7 +172,9 @@ function resolver(incomingItem, existingItem, isTombstone, conflictingItems) {
166172
}
167173
```
168174

169-
### <a id="create-custom-conflict-resolution-policy-stored-proc-dotnet"></a>.NET SDK V2
175+
### <a id="create-custom-conflict-resolution-policy-stored-proc-dotnet"></a>.NET SDK
176+
177+
# [.NET SDK V2](#tab/dotnetv2)
170178

171179
```csharp
172180
DocumentCollection udpCollection = await createClient.CreateDocumentCollectionIfNotExistsAsync(
@@ -189,7 +197,7 @@ UriFactory.CreateStoredProcedureUri(this.databaseName, this.udpCollectionName, "
189197
});
190198
```
191199

192-
### <a id="create-custom-conflict-resolution-policy-stored-proc-dotnet-v3"></a>.NET SDK V3
200+
# [.NET SDK V3](#tab/dotnetv3)
193201

194202
```csharp
195203
Container container = await createClient.GetDatabase(this.databaseName)
@@ -206,8 +214,11 @@ await container.Scripts.CreateStoredProcedureAsync(
206214
new StoredProcedureProperties("resolver", File.ReadAllText(@"resolver.js"))
207215
);
208216
```
217+
---
218+
219+
### <a id="create-custom-conflict-resolution-policy-stored-proc-java"></a>Java SDK
209220

210-
### <a id="create-custom-conflict-resolution-policy-stored-proc-java-async"></a>Java Async SDK
221+
# [Java Async SDK](#tab/javaasync)
211222

212223
```java
213224
DocumentCollection collection = new DocumentCollection();
@@ -219,7 +230,7 @@ DocumentCollection createdCollection = client.createCollection(databaseUri, coll
219230

220231
After your container is created, you must create the `resolver` stored procedure.
221232

222-
### <a id="create-custom-conflict-resolution-policy-stored-proc-java-sync"></a>Java Sync SDK
233+
# [Java sync SDK](#tab/javasync)
223234

224235
```java
225236
DocumentCollection udpCollection = new DocumentCollection();
@@ -229,6 +240,7 @@ ConflictResolutionPolicy udpPolicy = ConflictResolutionPolicy.createCustomPolicy
229240
udpCollection.setConflictResolutionPolicy(udpPolicy);
230241
DocumentCollection createdCollection = this.tryCreateDocumentCollection(createClient, database, udpCollection);
231242
```
243+
---
232244

233245
After your container is created, you must create the `resolver` stored procedure.
234246

@@ -271,7 +283,9 @@ After your container is created, you must create the `resolver` stored procedure
271283

272284
These samples show how to set up a container with a custom conflict resolution policy. These conflicts show up in the conflict feed.
273285

274-
### <a id="create-custom-conflict-resolution-policy-dotnet"></a>.NET SDK V2
286+
### <a id="create-custom-conflict-resolution-policy-dotnet"></a>.NET SDK
287+
288+
# [.NET SDK V2](#tab/dotnetv2)
275289

276290
```csharp
277291
DocumentCollection manualCollection = await createClient.CreateDocumentCollectionIfNotExistsAsync(
@@ -284,8 +298,7 @@ DocumentCollection manualCollection = await createClient.CreateDocumentCollectio
284298
},
285299
});
286300
```
287-
288-
### <a id="create-custom-conflict-resolution-policy-dotnet-v3"></a>.NET SDK V3
301+
# [.NET SDK V3](#tab/dotnetv3)
289302

290303
```csharp
291304
Container container = await createClient.GetDatabase(this.databaseName)
@@ -297,8 +310,11 @@ Container container = await createClient.GetDatabase(this.databaseName)
297310
}
298311
});
299312
```
313+
---
300314

301-
### <a id="create-custom-conflict-resolution-policy-java-async"></a>Java Async SDK
315+
### <a id="create-custom-conflict-resolution-policy-java"></a>Java SDK
316+
317+
# [Java Async SDK](#tab/javaasync)
302318

303319
```java
304320
DocumentCollection collection = new DocumentCollection();
@@ -308,7 +324,7 @@ collection.setConflictResolutionPolicy(policy);
308324
DocumentCollection createdCollection = client.createCollection(databaseUri, collection, null).toBlocking().value();
309325
```
310326

311-
### <a id="create-custom-conflict-resolution-policy-java-sync"></a>Java Sync SDK
327+
# [Java sync SDK](#tab/javasync)
312328

313329
```java
314330
DocumentCollection manualCollection = new DocumentCollection();
@@ -317,6 +333,7 @@ ConflictResolutionPolicy customPolicy = ConflictResolutionPolicy.createCustomPol
317333
manualCollection.setConflictResolutionPolicy(customPolicy);
318334
DocumentCollection createdCollection = client.createCollection(database.getSelfLink(), collection, null).getResource();
319335
```
336+
---
320337

321338
### <a id="create-custom-conflict-resolution-policy-javascript"></a>Node.js/JavaScript/TypeScript SDK
322339

@@ -349,13 +366,15 @@ manual_collection = client.CreateContainer(database['_self'], collection)
349366

350367
These samples show how to read from a container's conflict feed. Conflicts show up in the conflict feed only if they weren't resolved automatically or if using a custom conflict policy.
351368

352-
### <a id="read-from-conflict-feed-dotnet"></a>.NET SDK V2
369+
### <a id="read-from-conflict-feed-dotnet"></a>.NET SDK
370+
371+
# [.NET SDK V2](#tab/dotnetv2)
353372

354373
```csharp
355374
FeedResponse<Conflict> conflicts = await delClient.ReadConflictFeedAsync(this.collectionUri);
356375
```
357376

358-
### <a id="read-from-conflict-feed-dotnet-v3"></a>.NET SDK V3
377+
# [.NET SDK V3](#tab/dotnetv3)
359378

360379
```csharp
361380
FeedIterator<ConflictProperties> conflictFeed = container.Conflicts.GetConflictQueryIterator();
@@ -377,7 +396,9 @@ while (conflictFeed.HasMoreResults)
377396
}
378397
```
379398

380-
### <a id="read-from-conflict-feed-java-async"></a>Java Async SDK
399+
### <a id="read-from-conflict-feed-java"></a>Java SDK
400+
401+
# [Java Async SDK](#tab/javaasync)
381402

382403
```java
383404
FeedResponse<Conflict> response = client.readConflicts(this.manualCollectionUri, null)
@@ -386,8 +407,7 @@ for (Conflict conflict : response.getResults()) {
386407
/* Do something with conflict */
387408
}
388409
```
389-
390-
### <a id="read-from-conflict-feed-java-sync"></a>Java Sync SDK
410+
# [Java Async SDK](#tab/javaasync)
391411

392412
```java
393413
Iterator<Conflict> conflictsIterator = client.readConflicts(this.collectionLink, null).getQueryIterator();
@@ -396,6 +416,7 @@ while (conflictsIterator.hasNext()) {
396416
/* Do something with conflict */
397417
}
398418
```
419+
---
399420

400421
### <a id="read-from-conflict-feed-javascript"></a>Node.js/JavaScript/TypeScript SDK
401422

0 commit comments

Comments
 (0)