diff --git a/docs/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx b/docs/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
index e9fe158519..b5a67818f5 100644
--- a/docs/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
+++ b/docs/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
@@ -1,27 +1,44 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to counter changes:
+
-- [ForCounter](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounter)
-- [ForCounterOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounterofdocument)
-- [ForCountersOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcountersofdocument)
-- [ForAllCounters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forallcounters)
+Subscribe to counter changes using `ForCounter`, `ForCounterOfDocument`,
+`ForCountersOfDocument`, or `ForAllCounters`.
-## ForCounter
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForCounter](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounter)
+ * [ForCounterOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounterofdocument)
+ * [ForCountersOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcountersofdocument)
+ * [ForAllCounters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forallcounters)
+ * [CounterChange and CounterChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)
+
+
+
+
Counter changes can be observed using `ForCounter` method. This will subscribe changes from all counters with a given name, no matter in what document counter was changed.
+
+
### Syntax
-
-
-{`IChangesObservable ForCounter(string counterName);
-`}
-
-
+```csharp
+IChangesObservable ForCounter(string counterName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -29,43 +46,45 @@ Counter changes can be observed using `ForCounter` method. This will subscribe c
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCounter("Likes")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForCounterOfDocument
+
Specific counter changes of a given document can be observed using `ForCounterOfDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForCounterOfDocument(string documentId, string counterName);
-`}
-
-
+```csharp
+IChangesObservable ForCounterOfDocument(string documentId, string counterName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -74,43 +93,45 @@ Specific counter changes of a given document can be observed using `ForCounterOf
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCounterOfDocument("companies/1-A", "Likes")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForCountersOfDocument
+
Counter changes of a specified document can be observed using `ForCountersOfDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForCountersOfDocument(string documentId);
-`}
-
-
+```csharp
+IChangesObservable ForCountersOfDocument(string documentId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -118,84 +139,117 @@ Counter changes of a specified document can be observed using `ForCountersOfDocu
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCountersOfDocument("companies/1-A")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllCounters
+
Changes for all counters can be observed using `ForAllCounters` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForAllCounters();
-`}
-
-
+```csharp
+IChangesObservable ForAllCounters();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllCounters()
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
-## CounterChange
+
+
-| Name | Type | Description |
+**The notification object delivered to subscribers when a counter changes.**
+
+```csharp
+class CounterChange
+{
+ CounterChangeTypes Type
+ string Name
+ long Value
+ string DocumentId
+ string CollectionName
+ string ChangeVector
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [CounterChangeTypes](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchangetypes) | Counter change type enum |
+| **Type** | [CounterChangeTypes](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax) | Counter change type enum |
| **Name** | string | Counter name |
| **Value** | long | Counter value after the change |
| **DocumentId** | string | Counter document identifier |
-| **ChangeVector** | string | Counter's ChangeVector|
-
-
+| **CollectionName** | string | Document's collection name |
+| **ChangeVector** | string | Counter's ChangeVector |
-## CounterChangeTypes
+
+
+
+```csharp
+enum CounterChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ Increment,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -204,13 +258,7 @@ Changes for all counters can be observed using `ForAllCounters` method.
| **Delete** | `2` |
| **Increment** | `4` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/docs/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx b/docs/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
index 684d3c9531..7c3ce68b5a 100644
--- a/docs/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
+++ b/docs/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
@@ -1,27 +1,44 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to document changes:
+
-- [ForDocument](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocument)
-- [ForDocumentsInCollection](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsincollection)
-- [ForDocumentsStartingWith](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsstartingwith)
-- [ForAllDocuments](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#foralldocuments)
+Subscribe to document changes using `ForDocument`, `ForDocumentsInCollection`,
+`ForDocumentsStartingWith`, or `ForAllDocuments`.
-## ForDocument
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForDocument](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocument)
+ * [ForDocumentsInCollection](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsincollection)
+ * [ForDocumentsStartingWith](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsstartingwith)
+ * [ForAllDocuments](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#foralldocuments)
+ * [DocumentChange and DocumentChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)
+
+
+
+
Single document changes can be observed using `ForDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocument(string docId);
-`}
-
-
+```csharp
+IChangesObservable ForDocument(string docId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -29,48 +46,50 @@ Single document changes can be observed using `ForDocument` method.
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocument("employees/1")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case DocumentChangeTypes.Put:
// do something
break;
case DocumentChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForDocumentsInCollection
+
To observe all document changes in particular collection use `ForDocumentInCollection` method. This method filters documents by `@collection` metadata property value.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocumentsInCollection(string collectionName);
+```csharp
+IChangesObservable ForDocumentsInCollection(string collectionName);
IChangesObservable ForDocumentsInCollection();
-`}
-
-
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -78,51 +97,51 @@ IChangesObservable ForDocumentsInCollection();
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document collection name. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document collection name. |
Overload with `TEntity` type uses `Conventions.GetCollectionName` to get collection name.
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocumentsInCollection()
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
or
-
-
-{`string collectionName = store.Conventions.FindCollectionName(typeof(Employee));
+```csharp
+string collectionName = store.Conventions.FindCollectionName(typeof(Employee));
IDisposable subscription = store
.Changes()
.ForDocumentsInCollection(collectionName)
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
-## ForDocumentsStartingWith
+
To observe all document changes for documents with ID that contains given prefix use `ForDocumentsStartingWith` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocumentsStartingWith(string docIdPrefix);
-`}
-
-
+```csharp
+IChangesObservable ForDocumentsStartingWith(string docIdPrefix);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -130,66 +149,100 @@ To observe all document changes for documents with ID that contains given prefix
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document ID prefix. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document ID prefix. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocumentsStartingWith("employees/1") // employees/1, employees/10, employees/11, etc.
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
-## ForAllDocuments
+
To observe all document changes use `ForAllDocuments` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForAllDocuments();
-`}
-
-
+```csharp
+IChangesObservable ForAllDocuments();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for all documents. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for all documents. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllDocuments() // employees/1, orders/1, customers/1, etc.
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
+
+
+
+
+
+
+**The notification object delivered to subscribers when a document changes.**
-## DocumentChange
+```csharp
+class DocumentChange
+{
+ DocumentChangeTypes Type
+ string Id
+ string CollectionName
+ string ChangeVector
+}
+```
+
-| Name | Type | Description |
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [DocumentChangeTypes](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchangetypes) | Document change type enum |
+| **Type** | [DocumentChangeTypes](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax) | Document change type enum |
| **Id** | string | Document identifier |
| **CollectionName** | string | Document's collection name |
-| **TypeName** | string | Type name |
-| **ChangeVector** | string | Document's ChangeVector|
+| **ChangeVector** | string | Document's ChangeVector |
-
-
-## DocumentChangeTypes
+
+
+
+```csharp
+enum DocumentChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ BulkInsertStarted,
+ BulkInsertEnded,
+ BulkInsertError,
+ DeleteOnTombstoneReplication,
+ Conflict,
+ Common,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -201,15 +254,9 @@ To observe all document changes use `ForAllDocuments` method.
| **BulkInsertError** | `16` |
| **DeleteOnTombstoneReplication** | `32` |
| **Conflict** | `64` |
-| **Common** | `Put & Delete` |
-
-
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
+| **Common** | `Put \| Delete` |
+
+
+
diff --git a/docs/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx b/docs/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
index 59857984a7..8112c66b38 100644
--- a/docs/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
+++ b/docs/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
@@ -1,46 +1,64 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to index changes:
+
-- [ForIndex](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forindex)
-- [ForAllIndexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forallindexes)
+Subscribe to index changes using `ForIndex` or `ForAllIndexes`.
-## ForIndex
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForIndex](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forindex)
+ * [ForAllIndexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forallindexes)
+ * [IndexChange and IndexChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)
+
+
+
+
Index changes for one index can be observed using `ForIndex` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForIndex(string indexName);
-`}
-
-
+```csharp
+IChangesObservable ForIndex(string indexName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
| **indexName** | string | Name of an index for which notifications will be processed. |
-| Return value | |
+| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange)> | Observable that allows to add subscriptions to notifications for index with given name. |
+| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for index with given name. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForIndex("Orders/All")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case IndexChangeTypes.None:
//Do someting
break;
@@ -79,58 +97,91 @@ Index changes for one index can be observed using `ForIndex` method.
break;
default:
throw new ArgumentOutOfRangeException();
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllIndexes
+
Index changes for all indexex can be observed using `ForAllIndexes` method.
-| Return value | |
-| ------------- | ----- |
-| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange)> | Observable that allows to add subscriptions to notifications for all indexes. |
+
### Syntax
-
-
-{`IChangesObservable ForAllIndexes();
-`}
-
-
+```csharp
+IChangesObservable ForAllIndexes();
+```
+
+
+| Return Value | |
+| ------------- | ----- |
+| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for all indexes. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllIndexes()
- .Subscribe(change => Console.WriteLine("\{0\} on index \{1\}", change.Type, change.Name));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on index {1}", change.Type, change.Name));
+```
+
+
-## IndexChange
+
-### Properties
+
+
-| Name | Type | Description |
-| ------------- | ------------- | ----- |
-| **Type** | [IndexChangeTypes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchangetypes) | Change type |
-| **Name** | string | Index name |
-| **Etag** | long? | Index Etag |
+**The notification object delivered to subscribers when an index changes.**
+```csharp
+class IndexChange
+{
+ IndexChangeTypes Type
+ string Name
+}
+```
+
+| Property | Type | Description |
+| ------------- | ------------- | ----- |
+| **Type** | [IndexChangeTypes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax) | Change type |
+| **Name** | string | Index name |
-## IndexChangeTypes
+
+
+
+```csharp
+enum IndexChangeTypes
+{
+ None,
+ BatchCompleted,
+ IndexAdded,
+ IndexRemoved,
+ IndexDemotedToIdle,
+ IndexPromotedFromIdle,
+ IndexDemotedToDisabled,
+ IndexMarkedAsErrored,
+ SideBySideReplace,
+ Renamed,
+ IndexPaused,
+ LockModeChanged,
+ PriorityChanged,
+ RollingIndexChanged,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -143,17 +194,13 @@ Index changes for all indexex can be observed using `ForAllIndexes` method.
| **IndexDemotedToDisabled** | `256` |
| **IndexMarkedAsErrored** | `512` |
| **SideBySideReplace** | `1024` |
+| **Renamed** | `2048` |
| **IndexPaused** | `4096` |
| **LockModeChanged** | `8192` |
| **PriorityChanged** | `16384` |
+| **RollingIndexChanged** | `65536` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/docs/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx b/docs/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
index bee95aa63c..8811dcd0b1 100644
--- a/docs/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
+++ b/docs/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
@@ -1,56 +1,74 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-The following methods allow you to subscribe to operation changes:
+
+
+Subscribe to operation changes using `ForOperationId` or `ForAllOperations`.
+
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
-- [ForOperationId](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foroperationid)
-- [ForAllOperations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foralloperations)
+* In this article:
+ * [ForOperationId](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foroperationid)
+ * [ForAllOperations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foralloperations)
+ * [Syntax](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)
-## ForOperationId
+
+
+
Operation changes for one operation can be observed using the `ForOperationId` method.
Please note that from RavenDB 6.2 on, operation changes can be tracked only on a **specific node**.
-The purpose of this change is to improve results consistency, as an operation may behave very differently
-on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
+The purpose of this change is to improve results consistency, as an operation may behave very differently
+on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
the operation fails over from one node to another.
-Tracking operations will therefore be possible only if the `Changes` API was
-[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
+Tracking operations will therefore be possible only if the `Changes` API was
+[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
tracking to a single node: `store.Changes(dbName, nodeTag)`
-### Syntax
+
-
-
-{`IChangesObservable ForOperationId(long operationId);
-`}
-
-
+### ForOperationId syntax
+
+```csharp
+IChangesObservable ForOperationId(long operationId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
| **operationId** | long | ID of an operation for which notifications will be processed. |
-| Return value | |
+| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationchange)> | Observable that allows you to add subscriptions to notifications for an operation with a given ID. |
+| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)> | Observable that allows you to add subscriptions to notifications for an operation with a given ID. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes(dbName, nodeTag)
.ForOperationId(operationId)
.Subscribe(
change =>
- \{
+ {
switch (change.State.Status)
- \{
+ {
case OperationStatus.InProgress:
//Do Something
break;
@@ -65,90 +83,132 @@ tracking to a single node: `store.Changes(dbName, nodeTag)`
break;
default:
throw new ArgumentOutOfRangeException();
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllOperations
+
Operations changes for all Operations can be observed using the `ForAllOperations` method.
Please note that from RavenDB 6.2 on, operation changes can be tracked only on a **specific node**.
-The purpose of this change is to improve results consistency, as an operation may behave very differently
-on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
+The purpose of this change is to improve results consistency, as an operation may behave very differently
+on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
the operation fails over from one node to another.
-Tracking operations will therefore be possible only if the `Changes` API was
-[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
+Tracking operations will therefore be possible only if the `Changes` API was
+[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
tracking to a single node: `store.Changes(dbName, nodeTag)`
+
+
+### ForAllOperations syntax
+
+```csharp
+IChangesObservable ForAllOperations();
+```
+
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationchange)> | Observable that allows to add subscriptions to notifications for all operations. |
+| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)> | Observable that allows to add subscriptions to notifications for all operations. |
-### Syntax
-
-
-
-{`IChangesObservable ForAllOperations();
-`}
-
-
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes(dbName, nodeTag)
.ForAllOperations()
- .Subscribe(change => Console.WriteLine("Operation #\{1\} reports progress: \{0\}", change.State.Progress.ToJson(), change.OperationId));
-`}
-
-
-
+ .Subscribe(change => Console.WriteLine("Operation #{1} reports progress: {0}", change.State.Progress.ToJson(), change.OperationId));
+```
+
-## OperationChange
+
-### Properties
-
-| Name | Type | Description |
-| ------------- | ------------- | ----- |
-| **State** | [OperationState](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationstate) | Operation state |
-| **OperationId** | long | Operation ID |
+
+
+
+**The notification object delivered to subscribers when an operation changes.**
-## OperationState
+```csharp
+class OperationStatusChange
+{
+ long OperationId
+ OperationState State
+}
+```
+
-### Members
-
-| Name | Type | Description |
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Result** | [IOperationResult](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationresult) | Operation result |
-| **Progress** | IOperationProgress| Instance of IOperationProgress (json representation of the progress) |
-| **Status** | [OperationStatus](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationstatus) | Operation status |
-
-
-## OperationResult
+| **OperationId** | long | Operation ID |
+| **State** | [OperationState](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation state |
-### Members
+
+
+
+```csharp
+class OperationState
+{
+ IOperationResult Result
+ IOperationProgress Progress
+ OperationStatus Status
+}
+```
+
+
+| Property | Type | Description |
+| ------------- | ------------- | ----- |
+| **Result** | [IOperationResult](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation result |
+| **Progress** | IOperationProgress | Instance of IOperationProgress (json representation of the progress) |
+| **Status** | [OperationStatus](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation status |
-| Name | Type | Description |
+
+
+
+
+
+
+```csharp
+interface IOperationResult
+{
+ string Message
+ bool ShouldPersist
+ bool CanMerge
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
| **Message** | string | Operation message |
| **ShouldPersist** | bool | determine whether or not the result should be saved in the storage |
+| **CanMerge** | bool | Whether this result can be merged with another operation result |
-
-## OperationStatus
-
-### OperationStatus (enum)
+
+
+
+```csharp
+enum OperationStatus
+{
+ InProgress,
+ Completed,
+ Faulted,
+ Canceled,
+}
+```
+
| Name | Description |
| ---- | ----- |
@@ -157,12 +217,7 @@ tracking to a single node: `store.Changes(dbName, nodeTag)`
| **Faulted** | `Indicates that the operation is faulted` |
| **Canceled** | `Indicates that the operation has been Canceled` |
+
+
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/docs/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx b/docs/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
index f4349a81fd..76b6002940 100644
--- a/docs/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
+++ b/docs/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
@@ -1,7 +1,8 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
@@ -14,25 +15,36 @@ import CodeBlock from '@theme/CodeBlock';
* `ForAllTimeSeries`
Track **all** time series
-* In this page:
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
* [ForTimeSeries](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#fortimeseries)
* [ForTimeSeriesOfDocument](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#fortimeseriesofdocument)
* [ForAllTimeSeries](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#foralltimeseries)
+ * [TimeSeriesChange and TimeSeriesChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)
-## ForTimeSeries
-Subscribe to changes in **all time-series with a given name**, no matter which document they belong to,
-using the `ForTimeSeries` method.
+
-#### Syntax
+Subscribe to changes in **all time-series with a given name**, no matter which document they belong to,
+using the `ForTimeSeries` method.
-
-
-{`IChangesObservable ForTimeSeries(string timeSeriesName);
-`}
-
-
+
+
+### Syntax
+
+```csharp
+IChangesObservable ForTimeSeries(string timeSeriesName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -40,49 +52,53 @@ using the `ForTimeSeries` method.
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
-#### Example
+
+
-
-
-{`IDisposable subscription = store
+### Example
+
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeries("Likes")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForTimeSeriesOfDocument
+
-Use `ForTimeSeriesOfDocument` to subscribe to changes in **time series of a chosen document**.
+Use `ForTimeSeriesOfDocument` to subscribe to changes in **time series of a chosen document**.
* Two overload methods allow you to
* Track **a specific** time series of the chosen document
* Track **any** time series of the chosen document
+
+
+
### Overload #1
-Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific time** series of the chosen document.
+
+Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific time** series of the chosen document.
#### Syntax
-
-
-{`IChangesObservable ForTimeSeriesOfDocument(string documentId, string timeSeriesName);
-`}
-
-
+```csharp
+IChangesObservable ForTimeSeriesOfDocument(string documentId, string timeSeriesName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -91,39 +107,39 @@ Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific tim
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
#### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeriesOfDocument("companies/1-A", "Likes")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
### Overload #2
-Use this `ForTimeSeriesOfDocument` overload to track changes in **any time series** of the chosen document.
+
+Use this `ForTimeSeriesOfDocument` overload to track changes in **any time series** of the chosen document.
#### Syntax
-
-
-{`IChangesObservable ForTimeSeriesOfDocument(string documentId);
-`}
-
-
+```csharp
+IChangesObservable ForTimeSeriesOfDocument(string documentId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -131,76 +147,96 @@ Use this `ForTimeSeriesOfDocument` overload to track changes in **any time serie
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
#### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeriesOfDocument("companies/1-A")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllTimeSeries
+
-Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
+Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
-#### Syntax
+
-
-
-{`IChangesObservable ForAllTimeSeries();
-`}
-
-
+### Syntax
+
+```csharp
+IChangesObservable ForAllTimeSeries();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
-#### Example
+
+
+
+### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllTimeSeries()
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
+
+
+
-## TimeSeriesChange
+**The notification object delivered to subscribers when a time series changes.**
-| Name | Type | Description |
+```csharp
+class TimeSeriesChange
+{
+ TimeSeriesChangeTypes Type
+ string Name
+ string DocumentId
+ string CollectionName
+ DateTime From
+ DateTime To
+ string ChangeVector
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [TimeSeriesChangeTypes](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschangetypes) | Time series change type enum |
+| **Type** | [TimeSeriesChangeTypes](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax) | Time series change type enum |
| **Name** | string | Time Series Name |
| **DocumentId** | string | Time series Document Identifier |
| **CollectionName** | string | Time series document Collection Name |
@@ -208,9 +244,19 @@ Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
| **To** | DateTime | Time series values To date |
| **ChangeVector** | string | Time series Change Vector |
-
-
-## TimeSeriesChangeTypes
+
+
+
+```csharp
+enum TimeSeriesChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ Mixed,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -219,13 +265,7 @@ Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
| **Delete** | `2` |
| **Mixed** | `3` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/docs/client-api/changes/content/_what-is-changes-api-csharp.mdx b/docs/client-api/changes/content/_what-is-changes-api-csharp.mdx
index 240dac83d6..4df96de1ce 100644
--- a/docs/client-api/changes/content/_what-is-changes-api-csharp.mdx
+++ b/docs/client-api/changes/content/_what-is-changes-api-csharp.mdx
@@ -1,7 +1,5 @@
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
@@ -11,33 +9,36 @@ import CodeBlock from '@theme/CodeBlock';
* Using the Changes API allows you to notify users of various changes without requiring
any expensive polling.
-* In this page:
+
+The `Subscribe` method on the observables the Changes API returns accepts only an `IObserver`
+object by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
* [Accessing Changes API](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api)
* [Connection interface](../../../client-api/changes/what-is-changes-api.mdx#connection-interface)
* [Subscribing](../../../client-api/changes/what-is-changes-api.mdx#subscribing)
* [Unsubscribing](../../../client-api/changes/what-is-changes-api.mdx#unsubscribing)
- * [FAQ](../../../client-api/changes/what-is-changes-api.mdx#faq)
- * [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
- * [Changes API and Method Overloads](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-method-overloads)
+ * [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
* [Changes API -vs- Data Subscriptions](../../../client-api/changes/what-is-changes-api.mdx#changes-api--vs--data-subscriptions)
+
-## Accessing Changes API
+
+
The changes subscription is accessible by a document store through its `IDatabaseChanges`
or `ISingleNodeDatabaseChanges` interfaces.
-
-
-{`IDatabaseChanges Changes(string database = null);
-`}
-
-
-
-
-{`ISingleNodeDatabaseChanges Changes(string database, string nodeTag);
-`}
-
-
+```csharp
+IDatabaseChanges Changes(string database = null);
+
+ISingleNodeDatabaseChanges Changes(string database, string nodeTag);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -57,19 +58,18 @@ or `ISingleNodeDatabaseChanges` interfaces.
the second overload, passing both a database name and a node tag: `store.Changes(dbName, nodeTag)`
+
-
-## Connection interface
+
`IDatabaseChanges` inherits from `IConnectableChanges` interface that represent the connection.
-
-
-{`public interface IConnectableChanges : IDisposable
+```csharp
+public interface IConnectableChanges : IDisposable
where TChanges : IDatabaseChanges
-\{
+{
// returns state of the connection
- bool Connected \{ get; \}
+ bool Connected { get; }
// A task that ensures that the connection to the server was established.
Task EnsureConnectedNow();
@@ -79,14 +79,12 @@ or `ISingleNodeDatabaseChanges` interfaces.
//An action to take if an error occured in the connection to the server
event Action OnError;
-\}
-`}
-
-
-
+}
+```
+
-## Subscribing
+
To receive notifications regarding server-side events, subscribe using one of the following methods.
@@ -133,51 +131,40 @@ To receive notifications regarding server-side events, subscribe using one of th
* a **specific time series** of a given document (by Doc ID and Time Series Name)
* **any time series** of a given document (by Doc ID)
+
-
-## Unsubscribing
+
To end a subscription (stop listening for particular notifications) you must
`Dispose` of the subscription.
-
-
-{`IDatabaseChanges changes = store.Changes();
+```csharp
+IDatabaseChanges changes = store.Changes();
await changes.EnsureConnectedNow();
var subscription = changes
.ForAllDocuments()
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
try
-\{
+{
// application code here
-\}
+}
finally
-\{
+{
if (subscription != null)
subscription.Dispose();
-\}
-`}
-
-
-
+}
+```
+
-## FAQ
-
-#### Changes API and Database Timeout
+
One or more open Changes API connections will prevent a database from becoming
idle and unloaded, regardless of [the configuration value for database idle timeout](../../../server/configuration/database-configuration.mdx#databasesmaxidletimeinsec).
-#### Changes API and Method Overloads
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
+
-
-## Changes API -vs- Data Subscriptions
+
**Changes API** and [Data Subscription](../../../client-api/data-subscriptions/what-are-data-subscriptions.mdx)
are services that a RavenDB Server provides subscribing clients.
@@ -189,7 +176,7 @@ to their subscribers.
took place on the server, without receiving the actual data entities
affected by these events.
For the modification of a document, for example, the client will receive
- a [DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)
+ a [DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)
object with details like the document's ID and collection name.
* The server does **not** keep track of sent notifications or
@@ -208,3 +195,5 @@ to their subscribers.
| What can the server Track | [Documents](../../../client-api/data-subscriptions/what-are-data-subscriptions.mdx#documents-processing)
[Revisions](../../../client-api/data-subscriptions/advanced-topics/subscription-with-revisioning.mdx)
[Counters](../../../client-api/data-subscriptions/creation/examples.mdx#including-counters)
Time Series | [Documents](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx)
[Indexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx)
[Operations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx)
[Counters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx)
[Time Series](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx) |
| What can the server Deliver | Documents
Revisions
Counters
Time Series | Notifications |
| Management | Managed by the Server | Managed by the Client |
+
+
diff --git a/docs/client-api/changes/content/_what-is-changes-api-nodejs.mdx b/docs/client-api/changes/content/_what-is-changes-api-nodejs.mdx
index 2dc3ced34c..6b6dd1c04b 100644
--- a/docs/client-api/changes/content/_what-is-changes-api-nodejs.mdx
+++ b/docs/client-api/changes/content/_what-is-changes-api-nodejs.mdx
@@ -18,7 +18,6 @@ import CodeBlock from '@theme/CodeBlock';
* [Unsubscribing](../../../client-api/changes/what-is-changes-api.mdx#unsubscribing)
* [FAQ](../../../client-api/changes/what-is-changes-api.mdx#faq)
* [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
- * [Changes API and Method Overloads](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-method-overloads)
* [Changes API -vs- Data Subscriptions](../../../client-api/changes/what-is-changes-api.mdx#changes-api--vs--data-subscriptions)
## Accessing Changes API
@@ -110,14 +109,6 @@ try \{
One or more open Changes API connections will prevent a database from becoming
idle and unloaded, regardless of [the configuration value for database idle timeout](../../../server/configuration/database-configuration.mdx#databasesmaxidletimeinsec).
-#### Changes API and Method Overloads
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
## Changes API -vs- Data Subscriptions
diff --git a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
index e9fe158519..b5a67818f5 100644
--- a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
+++ b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
@@ -1,27 +1,44 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to counter changes:
+
-- [ForCounter](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounter)
-- [ForCounterOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounterofdocument)
-- [ForCountersOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcountersofdocument)
-- [ForAllCounters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forallcounters)
+Subscribe to counter changes using `ForCounter`, `ForCounterOfDocument`,
+`ForCountersOfDocument`, or `ForAllCounters`.
-## ForCounter
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForCounter](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounter)
+ * [ForCounterOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounterofdocument)
+ * [ForCountersOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcountersofdocument)
+ * [ForAllCounters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forallcounters)
+ * [CounterChange and CounterChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)
+
+
+
+
Counter changes can be observed using `ForCounter` method. This will subscribe changes from all counters with a given name, no matter in what document counter was changed.
+
+
### Syntax
-
-
-{`IChangesObservable ForCounter(string counterName);
-`}
-
-
+```csharp
+IChangesObservable ForCounter(string counterName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -29,43 +46,45 @@ Counter changes can be observed using `ForCounter` method. This will subscribe c
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCounter("Likes")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForCounterOfDocument
+
Specific counter changes of a given document can be observed using `ForCounterOfDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForCounterOfDocument(string documentId, string counterName);
-`}
-
-
+```csharp
+IChangesObservable ForCounterOfDocument(string documentId, string counterName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -74,43 +93,45 @@ Specific counter changes of a given document can be observed using `ForCounterOf
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCounterOfDocument("companies/1-A", "Likes")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForCountersOfDocument
+
Counter changes of a specified document can be observed using `ForCountersOfDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForCountersOfDocument(string documentId);
-`}
-
-
+```csharp
+IChangesObservable ForCountersOfDocument(string documentId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -118,84 +139,117 @@ Counter changes of a specified document can be observed using `ForCountersOfDocu
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCountersOfDocument("companies/1-A")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllCounters
+
Changes for all counters can be observed using `ForAllCounters` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForAllCounters();
-`}
-
-
+```csharp
+IChangesObservable ForAllCounters();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllCounters()
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
-## CounterChange
+
+
-| Name | Type | Description |
+**The notification object delivered to subscribers when a counter changes.**
+
+```csharp
+class CounterChange
+{
+ CounterChangeTypes Type
+ string Name
+ long Value
+ string DocumentId
+ string CollectionName
+ string ChangeVector
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [CounterChangeTypes](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchangetypes) | Counter change type enum |
+| **Type** | [CounterChangeTypes](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax) | Counter change type enum |
| **Name** | string | Counter name |
| **Value** | long | Counter value after the change |
| **DocumentId** | string | Counter document identifier |
-| **ChangeVector** | string | Counter's ChangeVector|
-
-
+| **CollectionName** | string | Document's collection name |
+| **ChangeVector** | string | Counter's ChangeVector |
-## CounterChangeTypes
+
+
+
+```csharp
+enum CounterChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ Increment,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -204,13 +258,7 @@ Changes for all counters can be observed using `ForAllCounters` method.
| **Delete** | `2` |
| **Increment** | `4` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
index 684d3c9531..7c3ce68b5a 100644
--- a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
+++ b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
@@ -1,27 +1,44 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to document changes:
+
-- [ForDocument](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocument)
-- [ForDocumentsInCollection](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsincollection)
-- [ForDocumentsStartingWith](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsstartingwith)
-- [ForAllDocuments](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#foralldocuments)
+Subscribe to document changes using `ForDocument`, `ForDocumentsInCollection`,
+`ForDocumentsStartingWith`, or `ForAllDocuments`.
-## ForDocument
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForDocument](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocument)
+ * [ForDocumentsInCollection](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsincollection)
+ * [ForDocumentsStartingWith](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsstartingwith)
+ * [ForAllDocuments](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#foralldocuments)
+ * [DocumentChange and DocumentChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)
+
+
+
+
Single document changes can be observed using `ForDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocument(string docId);
-`}
-
-
+```csharp
+IChangesObservable ForDocument(string docId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -29,48 +46,50 @@ Single document changes can be observed using `ForDocument` method.
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocument("employees/1")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case DocumentChangeTypes.Put:
// do something
break;
case DocumentChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForDocumentsInCollection
+
To observe all document changes in particular collection use `ForDocumentInCollection` method. This method filters documents by `@collection` metadata property value.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocumentsInCollection(string collectionName);
+```csharp
+IChangesObservable ForDocumentsInCollection(string collectionName);
IChangesObservable ForDocumentsInCollection();
-`}
-
-
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -78,51 +97,51 @@ IChangesObservable ForDocumentsInCollection();
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document collection name. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document collection name. |
Overload with `TEntity` type uses `Conventions.GetCollectionName` to get collection name.
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocumentsInCollection()
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
or
-
-
-{`string collectionName = store.Conventions.FindCollectionName(typeof(Employee));
+```csharp
+string collectionName = store.Conventions.FindCollectionName(typeof(Employee));
IDisposable subscription = store
.Changes()
.ForDocumentsInCollection(collectionName)
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
-## ForDocumentsStartingWith
+
To observe all document changes for documents with ID that contains given prefix use `ForDocumentsStartingWith` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocumentsStartingWith(string docIdPrefix);
-`}
-
-
+```csharp
+IChangesObservable ForDocumentsStartingWith(string docIdPrefix);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -130,66 +149,100 @@ To observe all document changes for documents with ID that contains given prefix
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document ID prefix. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document ID prefix. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocumentsStartingWith("employees/1") // employees/1, employees/10, employees/11, etc.
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
-## ForAllDocuments
+
To observe all document changes use `ForAllDocuments` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForAllDocuments();
-`}
-
-
+```csharp
+IChangesObservable ForAllDocuments();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for all documents. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for all documents. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllDocuments() // employees/1, orders/1, customers/1, etc.
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
+
+
+
+
+
+
+**The notification object delivered to subscribers when a document changes.**
-## DocumentChange
+```csharp
+class DocumentChange
+{
+ DocumentChangeTypes Type
+ string Id
+ string CollectionName
+ string ChangeVector
+}
+```
+
-| Name | Type | Description |
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [DocumentChangeTypes](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchangetypes) | Document change type enum |
+| **Type** | [DocumentChangeTypes](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax) | Document change type enum |
| **Id** | string | Document identifier |
| **CollectionName** | string | Document's collection name |
-| **TypeName** | string | Type name |
-| **ChangeVector** | string | Document's ChangeVector|
+| **ChangeVector** | string | Document's ChangeVector |
-
-
-## DocumentChangeTypes
+
+
+
+```csharp
+enum DocumentChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ BulkInsertStarted,
+ BulkInsertEnded,
+ BulkInsertError,
+ DeleteOnTombstoneReplication,
+ Conflict,
+ Common,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -201,15 +254,9 @@ To observe all document changes use `ForAllDocuments` method.
| **BulkInsertError** | `16` |
| **DeleteOnTombstoneReplication** | `32` |
| **Conflict** | `64` |
-| **Common** | `Put & Delete` |
-
-
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
+| **Common** | `Put \| Delete` |
+
+
+
diff --git a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
index 59857984a7..8112c66b38 100644
--- a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
+++ b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
@@ -1,46 +1,64 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to index changes:
+
-- [ForIndex](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forindex)
-- [ForAllIndexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forallindexes)
+Subscribe to index changes using `ForIndex` or `ForAllIndexes`.
-## ForIndex
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForIndex](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forindex)
+ * [ForAllIndexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forallindexes)
+ * [IndexChange and IndexChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)
+
+
+
+
Index changes for one index can be observed using `ForIndex` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForIndex(string indexName);
-`}
-
-
+```csharp
+IChangesObservable ForIndex(string indexName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
| **indexName** | string | Name of an index for which notifications will be processed. |
-| Return value | |
+| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange)> | Observable that allows to add subscriptions to notifications for index with given name. |
+| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for index with given name. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForIndex("Orders/All")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case IndexChangeTypes.None:
//Do someting
break;
@@ -79,58 +97,91 @@ Index changes for one index can be observed using `ForIndex` method.
break;
default:
throw new ArgumentOutOfRangeException();
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllIndexes
+
Index changes for all indexex can be observed using `ForAllIndexes` method.
-| Return value | |
-| ------------- | ----- |
-| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange)> | Observable that allows to add subscriptions to notifications for all indexes. |
+
### Syntax
-
-
-{`IChangesObservable ForAllIndexes();
-`}
-
-
+```csharp
+IChangesObservable ForAllIndexes();
+```
+
+
+| Return Value | |
+| ------------- | ----- |
+| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for all indexes. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllIndexes()
- .Subscribe(change => Console.WriteLine("\{0\} on index \{1\}", change.Type, change.Name));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on index {1}", change.Type, change.Name));
+```
+
+
-## IndexChange
+
-### Properties
+
+
-| Name | Type | Description |
-| ------------- | ------------- | ----- |
-| **Type** | [IndexChangeTypes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchangetypes) | Change type |
-| **Name** | string | Index name |
-| **Etag** | long? | Index Etag |
+**The notification object delivered to subscribers when an index changes.**
+```csharp
+class IndexChange
+{
+ IndexChangeTypes Type
+ string Name
+}
+```
+
+| Property | Type | Description |
+| ------------- | ------------- | ----- |
+| **Type** | [IndexChangeTypes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax) | Change type |
+| **Name** | string | Index name |
-## IndexChangeTypes
+
+
+
+```csharp
+enum IndexChangeTypes
+{
+ None,
+ BatchCompleted,
+ IndexAdded,
+ IndexRemoved,
+ IndexDemotedToIdle,
+ IndexPromotedFromIdle,
+ IndexDemotedToDisabled,
+ IndexMarkedAsErrored,
+ SideBySideReplace,
+ Renamed,
+ IndexPaused,
+ LockModeChanged,
+ PriorityChanged,
+ RollingIndexChanged,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -143,17 +194,13 @@ Index changes for all indexex can be observed using `ForAllIndexes` method.
| **IndexDemotedToDisabled** | `256` |
| **IndexMarkedAsErrored** | `512` |
| **SideBySideReplace** | `1024` |
+| **Renamed** | `2048` |
| **IndexPaused** | `4096` |
| **LockModeChanged** | `8192` |
| **PriorityChanged** | `16384` |
+| **RollingIndexChanged** | `65536` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
index 377fd6f871..8811dcd0b1 100644
--- a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
+++ b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
@@ -1,56 +1,74 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-The following methods allow you to subscribe to operation changes:
+
+
+Subscribe to operation changes using `ForOperationId` or `ForAllOperations`.
+
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
-- [ForOperationId](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foroperationid)
-- [ForAllOperations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foralloperations)
+* In this article:
+ * [ForOperationId](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foroperationid)
+ * [ForAllOperations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foralloperations)
+ * [Syntax](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)
-## ForOperationId
+
+
+
Operation changes for one operation can be observed using the `ForOperationId` method.
Please note that from RavenDB 6.2 on, operation changes can be tracked only on a **specific node**.
-The purpose of this change is to improve results consistency, as an operation may behave very differently
-on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
+The purpose of this change is to improve results consistency, as an operation may behave very differently
+on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
the operation fails over from one node to another.
-Tracking operations will therefore be possible only if the `Changes` API was
-[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
+Tracking operations will therefore be possible only if the `Changes` API was
+[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
tracking to a single node: `store.Changes(dbName, nodeTag)`
-### Syntax
+
-
-
-{`IChangesObservable ForOperationId(long operationId);
-`}
-
-
+### ForOperationId syntax
+
+```csharp
+IChangesObservable ForOperationId(long operationId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
| **operationId** | long | ID of an operation for which notifications will be processed. |
-| Return value | |
+| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationchange)> | Observable that allows you to add subscriptions to notifications for an operation with a given ID. |
+| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)> | Observable that allows you to add subscriptions to notifications for an operation with a given ID. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes(dbName, nodeTag)
.ForOperationId(operationId)
.Subscribe(
change =>
- \{
+ {
switch (change.State.Status)
- \{
+ {
case OperationStatus.InProgress:
//Do Something
break;
@@ -65,90 +83,132 @@ tracking to a single node: `store.Changes(dbName, nodeTag)`
break;
default:
throw new ArgumentOutOfRangeException();
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllOperations
+
Operations changes for all Operations can be observed using the `ForAllOperations` method.
Please note that from RavenDB 6.2 on, operation changes can be tracked only on a **specific node**.
-The purpose of this change is to improve results consistency, as an operation may behave very differently
-on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
+The purpose of this change is to improve results consistency, as an operation may behave very differently
+on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
the operation fails over from one node to another.
-Tracking operations will therefore be possible only if the `Changes` API was
-[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
+Tracking operations will therefore be possible only if the `Changes` API was
+[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
tracking to a single node: `store.Changes(dbName, nodeTag)`
+
+
+### ForAllOperations syntax
+
+```csharp
+IChangesObservable ForAllOperations();
+```
+
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationchange)> | Observable that allows to add subscriptions to notifications for all operations. |
+| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)> | Observable that allows to add subscriptions to notifications for all operations. |
-### Syntax
-
-
-
-{`IChangesObservable ForAllOperations();
-`}
-
-
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes(dbName, nodeTag)
.ForAllOperations()
- .Subscribe(change => Console.WriteLine("Operation #\{1\} reports progress: \{0\}", change.State.Progress.ToJson(), change.OperationId));
-`}
-
-
-
+ .Subscribe(change => Console.WriteLine("Operation #{1} reports progress: {0}", change.State.Progress.ToJson(), change.OperationId));
+```
+
-## OperationChange
+
-### Properties
-
-| Name | Type | Description |
-| ------------- | ------------- | ----- |
-| **State** | [OperationState](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationstate) | Operation state |
-| **OperationId** | long | Operation ID |
+
+
+
+**The notification object delivered to subscribers when an operation changes.**
-## OperationState
+```csharp
+class OperationStatusChange
+{
+ long OperationId
+ OperationState State
+}
+```
+
-### Members
-
-| Name | Type | Description |
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Result** | [IOperationResult](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationresult) | Operation result |
-| **Progress** | IOperationProgress| Instance of IOperationProgress (json representation of the progress) |
-| **Status** | [OperationStatus](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationstatus) | Operation status |
-
-
-## OperationResult
+| **OperationId** | long | Operation ID |
+| **State** | [OperationState](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation state |
-### Members
+
+
+
+```csharp
+class OperationState
+{
+ IOperationResult Result
+ IOperationProgress Progress
+ OperationStatus Status
+}
+```
+
+
+| Property | Type | Description |
+| ------------- | ------------- | ----- |
+| **Result** | [IOperationResult](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation result |
+| **Progress** | IOperationProgress | Instance of IOperationProgress (json representation of the progress) |
+| **Status** | [OperationStatus](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation status |
-| Name | Type | Description |
+
+
+
+
+
+
+```csharp
+interface IOperationResult
+{
+ string Message
+ bool ShouldPersist
+ bool CanMerge
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
| **Message** | string | Operation message |
| **ShouldPersist** | bool | determine whether or not the result should be saved in the storage |
+| **CanMerge** | bool | Whether this result can be merged with another operation result |
-
-## OperationStatus
-
-# OperationStatus (enum)
+
+
+
+```csharp
+enum OperationStatus
+{
+ InProgress,
+ Completed,
+ Faulted,
+ Canceled,
+}
+```
+
| Name | Description |
| ---- | ----- |
@@ -157,12 +217,7 @@ tracking to a single node: `store.Changes(dbName, nodeTag)`
| **Faulted** | `Indicates that the operation is faulted` |
| **Canceled** | `Indicates that the operation has been Canceled` |
+
+
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
index f4349a81fd..76b6002940 100644
--- a/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
+++ b/versioned_docs/version-6.2/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
@@ -1,7 +1,8 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
@@ -14,25 +15,36 @@ import CodeBlock from '@theme/CodeBlock';
* `ForAllTimeSeries`
Track **all** time series
-* In this page:
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
* [ForTimeSeries](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#fortimeseries)
* [ForTimeSeriesOfDocument](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#fortimeseriesofdocument)
* [ForAllTimeSeries](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#foralltimeseries)
+ * [TimeSeriesChange and TimeSeriesChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)
-## ForTimeSeries
-Subscribe to changes in **all time-series with a given name**, no matter which document they belong to,
-using the `ForTimeSeries` method.
+
-#### Syntax
+Subscribe to changes in **all time-series with a given name**, no matter which document they belong to,
+using the `ForTimeSeries` method.
-
-
-{`IChangesObservable ForTimeSeries(string timeSeriesName);
-`}
-
-
+
+
+### Syntax
+
+```csharp
+IChangesObservable ForTimeSeries(string timeSeriesName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -40,49 +52,53 @@ using the `ForTimeSeries` method.
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
-#### Example
+
+
-
-
-{`IDisposable subscription = store
+### Example
+
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeries("Likes")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForTimeSeriesOfDocument
+
-Use `ForTimeSeriesOfDocument` to subscribe to changes in **time series of a chosen document**.
+Use `ForTimeSeriesOfDocument` to subscribe to changes in **time series of a chosen document**.
* Two overload methods allow you to
* Track **a specific** time series of the chosen document
* Track **any** time series of the chosen document
+
+
+
### Overload #1
-Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific time** series of the chosen document.
+
+Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific time** series of the chosen document.
#### Syntax
-
-
-{`IChangesObservable ForTimeSeriesOfDocument(string documentId, string timeSeriesName);
-`}
-
-
+```csharp
+IChangesObservable ForTimeSeriesOfDocument(string documentId, string timeSeriesName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -91,39 +107,39 @@ Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific tim
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
#### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeriesOfDocument("companies/1-A", "Likes")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
### Overload #2
-Use this `ForTimeSeriesOfDocument` overload to track changes in **any time series** of the chosen document.
+
+Use this `ForTimeSeriesOfDocument` overload to track changes in **any time series** of the chosen document.
#### Syntax
-
-
-{`IChangesObservable ForTimeSeriesOfDocument(string documentId);
-`}
-
-
+```csharp
+IChangesObservable ForTimeSeriesOfDocument(string documentId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -131,76 +147,96 @@ Use this `ForTimeSeriesOfDocument` overload to track changes in **any time serie
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
#### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeriesOfDocument("companies/1-A")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllTimeSeries
+
-Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
+Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
-#### Syntax
+
-
-
-{`IChangesObservable ForAllTimeSeries();
-`}
-
-
+### Syntax
+
+```csharp
+IChangesObservable ForAllTimeSeries();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
-#### Example
+
+
+
+### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllTimeSeries()
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
+
+
+
-## TimeSeriesChange
+**The notification object delivered to subscribers when a time series changes.**
-| Name | Type | Description |
+```csharp
+class TimeSeriesChange
+{
+ TimeSeriesChangeTypes Type
+ string Name
+ string DocumentId
+ string CollectionName
+ DateTime From
+ DateTime To
+ string ChangeVector
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [TimeSeriesChangeTypes](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschangetypes) | Time series change type enum |
+| **Type** | [TimeSeriesChangeTypes](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax) | Time series change type enum |
| **Name** | string | Time Series Name |
| **DocumentId** | string | Time series Document Identifier |
| **CollectionName** | string | Time series document Collection Name |
@@ -208,9 +244,19 @@ Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
| **To** | DateTime | Time series values To date |
| **ChangeVector** | string | Time series Change Vector |
-
-
-## TimeSeriesChangeTypes
+
+
+
+```csharp
+enum TimeSeriesChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ Mixed,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -219,13 +265,7 @@ Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
| **Delete** | `2` |
| **Mixed** | `3` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-6.2/client-api/changes/content/_what-is-changes-api-csharp.mdx b/versioned_docs/version-6.2/client-api/changes/content/_what-is-changes-api-csharp.mdx
index 240dac83d6..4df96de1ce 100644
--- a/versioned_docs/version-6.2/client-api/changes/content/_what-is-changes-api-csharp.mdx
+++ b/versioned_docs/version-6.2/client-api/changes/content/_what-is-changes-api-csharp.mdx
@@ -1,7 +1,5 @@
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
@@ -11,33 +9,36 @@ import CodeBlock from '@theme/CodeBlock';
* Using the Changes API allows you to notify users of various changes without requiring
any expensive polling.
-* In this page:
+
+The `Subscribe` method on the observables the Changes API returns accepts only an `IObserver`
+object by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
* [Accessing Changes API](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api)
* [Connection interface](../../../client-api/changes/what-is-changes-api.mdx#connection-interface)
* [Subscribing](../../../client-api/changes/what-is-changes-api.mdx#subscribing)
* [Unsubscribing](../../../client-api/changes/what-is-changes-api.mdx#unsubscribing)
- * [FAQ](../../../client-api/changes/what-is-changes-api.mdx#faq)
- * [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
- * [Changes API and Method Overloads](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-method-overloads)
+ * [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
* [Changes API -vs- Data Subscriptions](../../../client-api/changes/what-is-changes-api.mdx#changes-api--vs--data-subscriptions)
+
-## Accessing Changes API
+
+
The changes subscription is accessible by a document store through its `IDatabaseChanges`
or `ISingleNodeDatabaseChanges` interfaces.
-
-
-{`IDatabaseChanges Changes(string database = null);
-`}
-
-
-
-
-{`ISingleNodeDatabaseChanges Changes(string database, string nodeTag);
-`}
-
-
+```csharp
+IDatabaseChanges Changes(string database = null);
+
+ISingleNodeDatabaseChanges Changes(string database, string nodeTag);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -57,19 +58,18 @@ or `ISingleNodeDatabaseChanges` interfaces.
the second overload, passing both a database name and a node tag: `store.Changes(dbName, nodeTag)`
+
-
-## Connection interface
+
`IDatabaseChanges` inherits from `IConnectableChanges` interface that represent the connection.
-
-
-{`public interface IConnectableChanges : IDisposable
+```csharp
+public interface IConnectableChanges : IDisposable
where TChanges : IDatabaseChanges
-\{
+{
// returns state of the connection
- bool Connected \{ get; \}
+ bool Connected { get; }
// A task that ensures that the connection to the server was established.
Task EnsureConnectedNow();
@@ -79,14 +79,12 @@ or `ISingleNodeDatabaseChanges` interfaces.
//An action to take if an error occured in the connection to the server
event Action OnError;
-\}
-`}
-
-
-
+}
+```
+
-## Subscribing
+
To receive notifications regarding server-side events, subscribe using one of the following methods.
@@ -133,51 +131,40 @@ To receive notifications regarding server-side events, subscribe using one of th
* a **specific time series** of a given document (by Doc ID and Time Series Name)
* **any time series** of a given document (by Doc ID)
+
-
-## Unsubscribing
+
To end a subscription (stop listening for particular notifications) you must
`Dispose` of the subscription.
-
-
-{`IDatabaseChanges changes = store.Changes();
+```csharp
+IDatabaseChanges changes = store.Changes();
await changes.EnsureConnectedNow();
var subscription = changes
.ForAllDocuments()
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
try
-\{
+{
// application code here
-\}
+}
finally
-\{
+{
if (subscription != null)
subscription.Dispose();
-\}
-`}
-
-
-
+}
+```
+
-## FAQ
-
-#### Changes API and Database Timeout
+
One or more open Changes API connections will prevent a database from becoming
idle and unloaded, regardless of [the configuration value for database idle timeout](../../../server/configuration/database-configuration.mdx#databasesmaxidletimeinsec).
-#### Changes API and Method Overloads
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
+
-
-## Changes API -vs- Data Subscriptions
+
**Changes API** and [Data Subscription](../../../client-api/data-subscriptions/what-are-data-subscriptions.mdx)
are services that a RavenDB Server provides subscribing clients.
@@ -189,7 +176,7 @@ to their subscribers.
took place on the server, without receiving the actual data entities
affected by these events.
For the modification of a document, for example, the client will receive
- a [DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)
+ a [DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)
object with details like the document's ID and collection name.
* The server does **not** keep track of sent notifications or
@@ -208,3 +195,5 @@ to their subscribers.
| What can the server Track | [Documents](../../../client-api/data-subscriptions/what-are-data-subscriptions.mdx#documents-processing)
[Revisions](../../../client-api/data-subscriptions/advanced-topics/subscription-with-revisioning.mdx)
[Counters](../../../client-api/data-subscriptions/creation/examples.mdx#including-counters)
Time Series | [Documents](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx)
[Indexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx)
[Operations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx)
[Counters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx)
[Time Series](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx) |
| What can the server Deliver | Documents
Revisions
Counters
Time Series | Notifications |
| Management | Managed by the Server | Managed by the Client |
+
+
diff --git a/versioned_docs/version-6.2/client-api/changes/content/_what-is-changes-api-nodejs.mdx b/versioned_docs/version-6.2/client-api/changes/content/_what-is-changes-api-nodejs.mdx
index 2dc3ced34c..6b6dd1c04b 100644
--- a/versioned_docs/version-6.2/client-api/changes/content/_what-is-changes-api-nodejs.mdx
+++ b/versioned_docs/version-6.2/client-api/changes/content/_what-is-changes-api-nodejs.mdx
@@ -18,7 +18,6 @@ import CodeBlock from '@theme/CodeBlock';
* [Unsubscribing](../../../client-api/changes/what-is-changes-api.mdx#unsubscribing)
* [FAQ](../../../client-api/changes/what-is-changes-api.mdx#faq)
* [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
- * [Changes API and Method Overloads](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-method-overloads)
* [Changes API -vs- Data Subscriptions](../../../client-api/changes/what-is-changes-api.mdx#changes-api--vs--data-subscriptions)
## Accessing Changes API
@@ -110,14 +109,6 @@ try \{
One or more open Changes API connections will prevent a database from becoming
idle and unloaded, regardless of [the configuration value for database idle timeout](../../../server/configuration/database-configuration.mdx#databasesmaxidletimeinsec).
-#### Changes API and Method Overloads
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
## Changes API -vs- Data Subscriptions
diff --git a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
index e9fe158519..b5a67818f5 100644
--- a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
+++ b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
@@ -1,27 +1,44 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to counter changes:
+
-- [ForCounter](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounter)
-- [ForCounterOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounterofdocument)
-- [ForCountersOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcountersofdocument)
-- [ForAllCounters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forallcounters)
+Subscribe to counter changes using `ForCounter`, `ForCounterOfDocument`,
+`ForCountersOfDocument`, or `ForAllCounters`.
-## ForCounter
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForCounter](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounter)
+ * [ForCounterOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounterofdocument)
+ * [ForCountersOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcountersofdocument)
+ * [ForAllCounters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forallcounters)
+ * [CounterChange and CounterChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)
+
+
+
+
Counter changes can be observed using `ForCounter` method. This will subscribe changes from all counters with a given name, no matter in what document counter was changed.
+
+
### Syntax
-
-
-{`IChangesObservable ForCounter(string counterName);
-`}
-
-
+```csharp
+IChangesObservable ForCounter(string counterName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -29,43 +46,45 @@ Counter changes can be observed using `ForCounter` method. This will subscribe c
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCounter("Likes")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForCounterOfDocument
+
Specific counter changes of a given document can be observed using `ForCounterOfDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForCounterOfDocument(string documentId, string counterName);
-`}
-
-
+```csharp
+IChangesObservable ForCounterOfDocument(string documentId, string counterName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -74,43 +93,45 @@ Specific counter changes of a given document can be observed using `ForCounterOf
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCounterOfDocument("companies/1-A", "Likes")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForCountersOfDocument
+
Counter changes of a specified document can be observed using `ForCountersOfDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForCountersOfDocument(string documentId);
-`}
-
-
+```csharp
+IChangesObservable ForCountersOfDocument(string documentId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -118,84 +139,117 @@ Counter changes of a specified document can be observed using `ForCountersOfDocu
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCountersOfDocument("companies/1-A")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllCounters
+
Changes for all counters can be observed using `ForAllCounters` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForAllCounters();
-`}
-
-
+```csharp
+IChangesObservable ForAllCounters();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllCounters()
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
-## CounterChange
+
+
-| Name | Type | Description |
+**The notification object delivered to subscribers when a counter changes.**
+
+```csharp
+class CounterChange
+{
+ CounterChangeTypes Type
+ string Name
+ long Value
+ string DocumentId
+ string CollectionName
+ string ChangeVector
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [CounterChangeTypes](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchangetypes) | Counter change type enum |
+| **Type** | [CounterChangeTypes](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax) | Counter change type enum |
| **Name** | string | Counter name |
| **Value** | long | Counter value after the change |
| **DocumentId** | string | Counter document identifier |
-| **ChangeVector** | string | Counter's ChangeVector|
-
-
+| **CollectionName** | string | Document's collection name |
+| **ChangeVector** | string | Counter's ChangeVector |
-## CounterChangeTypes
+
+
+
+```csharp
+enum CounterChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ Increment,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -204,13 +258,7 @@ Changes for all counters can be observed using `ForAllCounters` method.
| **Delete** | `2` |
| **Increment** | `4` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
index 684d3c9531..7c3ce68b5a 100644
--- a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
+++ b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
@@ -1,27 +1,44 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to document changes:
+
-- [ForDocument](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocument)
-- [ForDocumentsInCollection](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsincollection)
-- [ForDocumentsStartingWith](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsstartingwith)
-- [ForAllDocuments](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#foralldocuments)
+Subscribe to document changes using `ForDocument`, `ForDocumentsInCollection`,
+`ForDocumentsStartingWith`, or `ForAllDocuments`.
-## ForDocument
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForDocument](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocument)
+ * [ForDocumentsInCollection](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsincollection)
+ * [ForDocumentsStartingWith](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsstartingwith)
+ * [ForAllDocuments](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#foralldocuments)
+ * [DocumentChange and DocumentChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)
+
+
+
+
Single document changes can be observed using `ForDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocument(string docId);
-`}
-
-
+```csharp
+IChangesObservable ForDocument(string docId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -29,48 +46,50 @@ Single document changes can be observed using `ForDocument` method.
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocument("employees/1")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case DocumentChangeTypes.Put:
// do something
break;
case DocumentChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForDocumentsInCollection
+
To observe all document changes in particular collection use `ForDocumentInCollection` method. This method filters documents by `@collection` metadata property value.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocumentsInCollection(string collectionName);
+```csharp
+IChangesObservable ForDocumentsInCollection(string collectionName);
IChangesObservable ForDocumentsInCollection();
-`}
-
-
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -78,51 +97,51 @@ IChangesObservable ForDocumentsInCollection();
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document collection name. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document collection name. |
Overload with `TEntity` type uses `Conventions.GetCollectionName` to get collection name.
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocumentsInCollection()
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
or
-
-
-{`string collectionName = store.Conventions.FindCollectionName(typeof(Employee));
+```csharp
+string collectionName = store.Conventions.FindCollectionName(typeof(Employee));
IDisposable subscription = store
.Changes()
.ForDocumentsInCollection(collectionName)
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
-## ForDocumentsStartingWith
+
To observe all document changes for documents with ID that contains given prefix use `ForDocumentsStartingWith` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocumentsStartingWith(string docIdPrefix);
-`}
-
-
+```csharp
+IChangesObservable ForDocumentsStartingWith(string docIdPrefix);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -130,66 +149,100 @@ To observe all document changes for documents with ID that contains given prefix
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document ID prefix. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document ID prefix. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocumentsStartingWith("employees/1") // employees/1, employees/10, employees/11, etc.
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
-## ForAllDocuments
+
To observe all document changes use `ForAllDocuments` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForAllDocuments();
-`}
-
-
+```csharp
+IChangesObservable ForAllDocuments();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for all documents. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for all documents. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllDocuments() // employees/1, orders/1, customers/1, etc.
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
+
+
+
+
+
+
+**The notification object delivered to subscribers when a document changes.**
-## DocumentChange
+```csharp
+class DocumentChange
+{
+ DocumentChangeTypes Type
+ string Id
+ string CollectionName
+ string ChangeVector
+}
+```
+
-| Name | Type | Description |
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [DocumentChangeTypes](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchangetypes) | Document change type enum |
+| **Type** | [DocumentChangeTypes](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax) | Document change type enum |
| **Id** | string | Document identifier |
| **CollectionName** | string | Document's collection name |
-| **TypeName** | string | Type name |
-| **ChangeVector** | string | Document's ChangeVector|
+| **ChangeVector** | string | Document's ChangeVector |
-
-
-## DocumentChangeTypes
+
+
+
+```csharp
+enum DocumentChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ BulkInsertStarted,
+ BulkInsertEnded,
+ BulkInsertError,
+ DeleteOnTombstoneReplication,
+ Conflict,
+ Common,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -201,15 +254,9 @@ To observe all document changes use `ForAllDocuments` method.
| **BulkInsertError** | `16` |
| **DeleteOnTombstoneReplication** | `32` |
| **Conflict** | `64` |
-| **Common** | `Put & Delete` |
-
-
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
+| **Common** | `Put \| Delete` |
+
+
+
diff --git a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
index 59857984a7..8112c66b38 100644
--- a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
+++ b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
@@ -1,46 +1,64 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to index changes:
+
-- [ForIndex](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forindex)
-- [ForAllIndexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forallindexes)
+Subscribe to index changes using `ForIndex` or `ForAllIndexes`.
-## ForIndex
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForIndex](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forindex)
+ * [ForAllIndexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forallindexes)
+ * [IndexChange and IndexChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)
+
+
+
+
Index changes for one index can be observed using `ForIndex` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForIndex(string indexName);
-`}
-
-
+```csharp
+IChangesObservable ForIndex(string indexName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
| **indexName** | string | Name of an index for which notifications will be processed. |
-| Return value | |
+| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange)> | Observable that allows to add subscriptions to notifications for index with given name. |
+| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for index with given name. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForIndex("Orders/All")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case IndexChangeTypes.None:
//Do someting
break;
@@ -79,58 +97,91 @@ Index changes for one index can be observed using `ForIndex` method.
break;
default:
throw new ArgumentOutOfRangeException();
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllIndexes
+
Index changes for all indexex can be observed using `ForAllIndexes` method.
-| Return value | |
-| ------------- | ----- |
-| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange)> | Observable that allows to add subscriptions to notifications for all indexes. |
+
### Syntax
-
-
-{`IChangesObservable ForAllIndexes();
-`}
-
-
+```csharp
+IChangesObservable ForAllIndexes();
+```
+
+
+| Return Value | |
+| ------------- | ----- |
+| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for all indexes. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllIndexes()
- .Subscribe(change => Console.WriteLine("\{0\} on index \{1\}", change.Type, change.Name));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on index {1}", change.Type, change.Name));
+```
+
+
-## IndexChange
+
-### Properties
+
+
-| Name | Type | Description |
-| ------------- | ------------- | ----- |
-| **Type** | [IndexChangeTypes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchangetypes) | Change type |
-| **Name** | string | Index name |
-| **Etag** | long? | Index Etag |
+**The notification object delivered to subscribers when an index changes.**
+```csharp
+class IndexChange
+{
+ IndexChangeTypes Type
+ string Name
+}
+```
+
+| Property | Type | Description |
+| ------------- | ------------- | ----- |
+| **Type** | [IndexChangeTypes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax) | Change type |
+| **Name** | string | Index name |
-## IndexChangeTypes
+
+
+
+```csharp
+enum IndexChangeTypes
+{
+ None,
+ BatchCompleted,
+ IndexAdded,
+ IndexRemoved,
+ IndexDemotedToIdle,
+ IndexPromotedFromIdle,
+ IndexDemotedToDisabled,
+ IndexMarkedAsErrored,
+ SideBySideReplace,
+ Renamed,
+ IndexPaused,
+ LockModeChanged,
+ PriorityChanged,
+ RollingIndexChanged,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -143,17 +194,13 @@ Index changes for all indexex can be observed using `ForAllIndexes` method.
| **IndexDemotedToDisabled** | `256` |
| **IndexMarkedAsErrored** | `512` |
| **SideBySideReplace** | `1024` |
+| **Renamed** | `2048` |
| **IndexPaused** | `4096` |
| **LockModeChanged** | `8192` |
| **PriorityChanged** | `16384` |
+| **RollingIndexChanged** | `65536` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
index bee95aa63c..8811dcd0b1 100644
--- a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
+++ b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
@@ -1,56 +1,74 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-The following methods allow you to subscribe to operation changes:
+
+
+Subscribe to operation changes using `ForOperationId` or `ForAllOperations`.
+
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
-- [ForOperationId](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foroperationid)
-- [ForAllOperations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foralloperations)
+* In this article:
+ * [ForOperationId](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foroperationid)
+ * [ForAllOperations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foralloperations)
+ * [Syntax](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)
-## ForOperationId
+
+
+
Operation changes for one operation can be observed using the `ForOperationId` method.
Please note that from RavenDB 6.2 on, operation changes can be tracked only on a **specific node**.
-The purpose of this change is to improve results consistency, as an operation may behave very differently
-on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
+The purpose of this change is to improve results consistency, as an operation may behave very differently
+on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
the operation fails over from one node to another.
-Tracking operations will therefore be possible only if the `Changes` API was
-[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
+Tracking operations will therefore be possible only if the `Changes` API was
+[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
tracking to a single node: `store.Changes(dbName, nodeTag)`
-### Syntax
+
-
-
-{`IChangesObservable ForOperationId(long operationId);
-`}
-
-
+### ForOperationId syntax
+
+```csharp
+IChangesObservable ForOperationId(long operationId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
| **operationId** | long | ID of an operation for which notifications will be processed. |
-| Return value | |
+| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationchange)> | Observable that allows you to add subscriptions to notifications for an operation with a given ID. |
+| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)> | Observable that allows you to add subscriptions to notifications for an operation with a given ID. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes(dbName, nodeTag)
.ForOperationId(operationId)
.Subscribe(
change =>
- \{
+ {
switch (change.State.Status)
- \{
+ {
case OperationStatus.InProgress:
//Do Something
break;
@@ -65,90 +83,132 @@ tracking to a single node: `store.Changes(dbName, nodeTag)`
break;
default:
throw new ArgumentOutOfRangeException();
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllOperations
+
Operations changes for all Operations can be observed using the `ForAllOperations` method.
Please note that from RavenDB 6.2 on, operation changes can be tracked only on a **specific node**.
-The purpose of this change is to improve results consistency, as an operation may behave very differently
-on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
+The purpose of this change is to improve results consistency, as an operation may behave very differently
+on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
the operation fails over from one node to another.
-Tracking operations will therefore be possible only if the `Changes` API was
-[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
+Tracking operations will therefore be possible only if the `Changes` API was
+[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
tracking to a single node: `store.Changes(dbName, nodeTag)`
+
+
+### ForAllOperations syntax
+
+```csharp
+IChangesObservable ForAllOperations();
+```
+
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationchange)> | Observable that allows to add subscriptions to notifications for all operations. |
+| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)> | Observable that allows to add subscriptions to notifications for all operations. |
-### Syntax
-
-
-
-{`IChangesObservable ForAllOperations();
-`}
-
-
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes(dbName, nodeTag)
.ForAllOperations()
- .Subscribe(change => Console.WriteLine("Operation #\{1\} reports progress: \{0\}", change.State.Progress.ToJson(), change.OperationId));
-`}
-
-
-
+ .Subscribe(change => Console.WriteLine("Operation #{1} reports progress: {0}", change.State.Progress.ToJson(), change.OperationId));
+```
+
-## OperationChange
+
-### Properties
-
-| Name | Type | Description |
-| ------------- | ------------- | ----- |
-| **State** | [OperationState](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationstate) | Operation state |
-| **OperationId** | long | Operation ID |
+
+
+
+**The notification object delivered to subscribers when an operation changes.**
-## OperationState
+```csharp
+class OperationStatusChange
+{
+ long OperationId
+ OperationState State
+}
+```
+
-### Members
-
-| Name | Type | Description |
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Result** | [IOperationResult](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationresult) | Operation result |
-| **Progress** | IOperationProgress| Instance of IOperationProgress (json representation of the progress) |
-| **Status** | [OperationStatus](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationstatus) | Operation status |
-
-
-## OperationResult
+| **OperationId** | long | Operation ID |
+| **State** | [OperationState](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation state |
-### Members
+
+
+
+```csharp
+class OperationState
+{
+ IOperationResult Result
+ IOperationProgress Progress
+ OperationStatus Status
+}
+```
+
+
+| Property | Type | Description |
+| ------------- | ------------- | ----- |
+| **Result** | [IOperationResult](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation result |
+| **Progress** | IOperationProgress | Instance of IOperationProgress (json representation of the progress) |
+| **Status** | [OperationStatus](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation status |
-| Name | Type | Description |
+
+
+
+
+
+
+```csharp
+interface IOperationResult
+{
+ string Message
+ bool ShouldPersist
+ bool CanMerge
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
| **Message** | string | Operation message |
| **ShouldPersist** | bool | determine whether or not the result should be saved in the storage |
+| **CanMerge** | bool | Whether this result can be merged with another operation result |
-
-## OperationStatus
-
-### OperationStatus (enum)
+
+
+
+```csharp
+enum OperationStatus
+{
+ InProgress,
+ Completed,
+ Faulted,
+ Canceled,
+}
+```
+
| Name | Description |
| ---- | ----- |
@@ -157,12 +217,7 @@ tracking to a single node: `store.Changes(dbName, nodeTag)`
| **Faulted** | `Indicates that the operation is faulted` |
| **Canceled** | `Indicates that the operation has been Canceled` |
+
+
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
index f4349a81fd..76b6002940 100644
--- a/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
+++ b/versioned_docs/version-7.0/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
@@ -1,7 +1,8 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
@@ -14,25 +15,36 @@ import CodeBlock from '@theme/CodeBlock';
* `ForAllTimeSeries`
Track **all** time series
-* In this page:
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
* [ForTimeSeries](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#fortimeseries)
* [ForTimeSeriesOfDocument](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#fortimeseriesofdocument)
* [ForAllTimeSeries](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#foralltimeseries)
+ * [TimeSeriesChange and TimeSeriesChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)
-## ForTimeSeries
-Subscribe to changes in **all time-series with a given name**, no matter which document they belong to,
-using the `ForTimeSeries` method.
+
-#### Syntax
+Subscribe to changes in **all time-series with a given name**, no matter which document they belong to,
+using the `ForTimeSeries` method.
-
-
-{`IChangesObservable ForTimeSeries(string timeSeriesName);
-`}
-
-
+
+
+### Syntax
+
+```csharp
+IChangesObservable ForTimeSeries(string timeSeriesName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -40,49 +52,53 @@ using the `ForTimeSeries` method.
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
-#### Example
+
+
-
-
-{`IDisposable subscription = store
+### Example
+
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeries("Likes")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForTimeSeriesOfDocument
+
-Use `ForTimeSeriesOfDocument` to subscribe to changes in **time series of a chosen document**.
+Use `ForTimeSeriesOfDocument` to subscribe to changes in **time series of a chosen document**.
* Two overload methods allow you to
* Track **a specific** time series of the chosen document
* Track **any** time series of the chosen document
+
+
+
### Overload #1
-Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific time** series of the chosen document.
+
+Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific time** series of the chosen document.
#### Syntax
-
-
-{`IChangesObservable ForTimeSeriesOfDocument(string documentId, string timeSeriesName);
-`}
-
-
+```csharp
+IChangesObservable ForTimeSeriesOfDocument(string documentId, string timeSeriesName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -91,39 +107,39 @@ Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific tim
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
#### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeriesOfDocument("companies/1-A", "Likes")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
### Overload #2
-Use this `ForTimeSeriesOfDocument` overload to track changes in **any time series** of the chosen document.
+
+Use this `ForTimeSeriesOfDocument` overload to track changes in **any time series** of the chosen document.
#### Syntax
-
-
-{`IChangesObservable ForTimeSeriesOfDocument(string documentId);
-`}
-
-
+```csharp
+IChangesObservable ForTimeSeriesOfDocument(string documentId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -131,76 +147,96 @@ Use this `ForTimeSeriesOfDocument` overload to track changes in **any time serie
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
#### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeriesOfDocument("companies/1-A")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllTimeSeries
+
-Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
+Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
-#### Syntax
+
-
-
-{`IChangesObservable ForAllTimeSeries();
-`}
-
-
+### Syntax
+
+```csharp
+IChangesObservable ForAllTimeSeries();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
-#### Example
+
+
+
+### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllTimeSeries()
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
+
+
+
-## TimeSeriesChange
+**The notification object delivered to subscribers when a time series changes.**
-| Name | Type | Description |
+```csharp
+class TimeSeriesChange
+{
+ TimeSeriesChangeTypes Type
+ string Name
+ string DocumentId
+ string CollectionName
+ DateTime From
+ DateTime To
+ string ChangeVector
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [TimeSeriesChangeTypes](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschangetypes) | Time series change type enum |
+| **Type** | [TimeSeriesChangeTypes](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax) | Time series change type enum |
| **Name** | string | Time Series Name |
| **DocumentId** | string | Time series Document Identifier |
| **CollectionName** | string | Time series document Collection Name |
@@ -208,9 +244,19 @@ Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
| **To** | DateTime | Time series values To date |
| **ChangeVector** | string | Time series Change Vector |
-
-
-## TimeSeriesChangeTypes
+
+
+
+```csharp
+enum TimeSeriesChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ Mixed,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -219,13 +265,7 @@ Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
| **Delete** | `2` |
| **Mixed** | `3` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-7.0/client-api/changes/content/_what-is-changes-api-csharp.mdx b/versioned_docs/version-7.0/client-api/changes/content/_what-is-changes-api-csharp.mdx
index 240dac83d6..4df96de1ce 100644
--- a/versioned_docs/version-7.0/client-api/changes/content/_what-is-changes-api-csharp.mdx
+++ b/versioned_docs/version-7.0/client-api/changes/content/_what-is-changes-api-csharp.mdx
@@ -1,7 +1,5 @@
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
@@ -11,33 +9,36 @@ import CodeBlock from '@theme/CodeBlock';
* Using the Changes API allows you to notify users of various changes without requiring
any expensive polling.
-* In this page:
+
+The `Subscribe` method on the observables the Changes API returns accepts only an `IObserver`
+object by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
* [Accessing Changes API](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api)
* [Connection interface](../../../client-api/changes/what-is-changes-api.mdx#connection-interface)
* [Subscribing](../../../client-api/changes/what-is-changes-api.mdx#subscribing)
* [Unsubscribing](../../../client-api/changes/what-is-changes-api.mdx#unsubscribing)
- * [FAQ](../../../client-api/changes/what-is-changes-api.mdx#faq)
- * [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
- * [Changes API and Method Overloads](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-method-overloads)
+ * [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
* [Changes API -vs- Data Subscriptions](../../../client-api/changes/what-is-changes-api.mdx#changes-api--vs--data-subscriptions)
+
-## Accessing Changes API
+
+
The changes subscription is accessible by a document store through its `IDatabaseChanges`
or `ISingleNodeDatabaseChanges` interfaces.
-
-
-{`IDatabaseChanges Changes(string database = null);
-`}
-
-
-
-
-{`ISingleNodeDatabaseChanges Changes(string database, string nodeTag);
-`}
-
-
+```csharp
+IDatabaseChanges Changes(string database = null);
+
+ISingleNodeDatabaseChanges Changes(string database, string nodeTag);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -57,19 +58,18 @@ or `ISingleNodeDatabaseChanges` interfaces.
the second overload, passing both a database name and a node tag: `store.Changes(dbName, nodeTag)`
+
-
-## Connection interface
+
`IDatabaseChanges` inherits from `IConnectableChanges` interface that represent the connection.
-
-
-{`public interface IConnectableChanges : IDisposable
+```csharp
+public interface IConnectableChanges : IDisposable
where TChanges : IDatabaseChanges
-\{
+{
// returns state of the connection
- bool Connected \{ get; \}
+ bool Connected { get; }
// A task that ensures that the connection to the server was established.
Task EnsureConnectedNow();
@@ -79,14 +79,12 @@ or `ISingleNodeDatabaseChanges` interfaces.
//An action to take if an error occured in the connection to the server
event Action OnError;
-\}
-`}
-
-
-
+}
+```
+
-## Subscribing
+
To receive notifications regarding server-side events, subscribe using one of the following methods.
@@ -133,51 +131,40 @@ To receive notifications regarding server-side events, subscribe using one of th
* a **specific time series** of a given document (by Doc ID and Time Series Name)
* **any time series** of a given document (by Doc ID)
+
-
-## Unsubscribing
+
To end a subscription (stop listening for particular notifications) you must
`Dispose` of the subscription.
-
-
-{`IDatabaseChanges changes = store.Changes();
+```csharp
+IDatabaseChanges changes = store.Changes();
await changes.EnsureConnectedNow();
var subscription = changes
.ForAllDocuments()
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
try
-\{
+{
// application code here
-\}
+}
finally
-\{
+{
if (subscription != null)
subscription.Dispose();
-\}
-`}
-
-
-
+}
+```
+
-## FAQ
-
-#### Changes API and Database Timeout
+
One or more open Changes API connections will prevent a database from becoming
idle and unloaded, regardless of [the configuration value for database idle timeout](../../../server/configuration/database-configuration.mdx#databasesmaxidletimeinsec).
-#### Changes API and Method Overloads
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
+
-
-## Changes API -vs- Data Subscriptions
+
**Changes API** and [Data Subscription](../../../client-api/data-subscriptions/what-are-data-subscriptions.mdx)
are services that a RavenDB Server provides subscribing clients.
@@ -189,7 +176,7 @@ to their subscribers.
took place on the server, without receiving the actual data entities
affected by these events.
For the modification of a document, for example, the client will receive
- a [DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)
+ a [DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)
object with details like the document's ID and collection name.
* The server does **not** keep track of sent notifications or
@@ -208,3 +195,5 @@ to their subscribers.
| What can the server Track | [Documents](../../../client-api/data-subscriptions/what-are-data-subscriptions.mdx#documents-processing)
[Revisions](../../../client-api/data-subscriptions/advanced-topics/subscription-with-revisioning.mdx)
[Counters](../../../client-api/data-subscriptions/creation/examples.mdx#including-counters)
Time Series | [Documents](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx)
[Indexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx)
[Operations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx)
[Counters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx)
[Time Series](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx) |
| What can the server Deliver | Documents
Revisions
Counters
Time Series | Notifications |
| Management | Managed by the Server | Managed by the Client |
+
+
diff --git a/versioned_docs/version-7.0/client-api/changes/content/_what-is-changes-api-nodejs.mdx b/versioned_docs/version-7.0/client-api/changes/content/_what-is-changes-api-nodejs.mdx
index 2dc3ced34c..6b6dd1c04b 100644
--- a/versioned_docs/version-7.0/client-api/changes/content/_what-is-changes-api-nodejs.mdx
+++ b/versioned_docs/version-7.0/client-api/changes/content/_what-is-changes-api-nodejs.mdx
@@ -18,7 +18,6 @@ import CodeBlock from '@theme/CodeBlock';
* [Unsubscribing](../../../client-api/changes/what-is-changes-api.mdx#unsubscribing)
* [FAQ](../../../client-api/changes/what-is-changes-api.mdx#faq)
* [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
- * [Changes API and Method Overloads](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-method-overloads)
* [Changes API -vs- Data Subscriptions](../../../client-api/changes/what-is-changes-api.mdx#changes-api--vs--data-subscriptions)
## Accessing Changes API
@@ -110,14 +109,6 @@ try \{
One or more open Changes API connections will prevent a database from becoming
idle and unloaded, regardless of [the configuration value for database idle timeout](../../../server/configuration/database-configuration.mdx#databasesmaxidletimeinsec).
-#### Changes API and Method Overloads
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
## Changes API -vs- Data Subscriptions
diff --git a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
index e9fe158519..b5a67818f5 100644
--- a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
+++ b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-counter-changes-csharp.mdx
@@ -1,27 +1,44 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to counter changes:
+
-- [ForCounter](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounter)
-- [ForCounterOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounterofdocument)
-- [ForCountersOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcountersofdocument)
-- [ForAllCounters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forallcounters)
+Subscribe to counter changes using `ForCounter`, `ForCounterOfDocument`,
+`ForCountersOfDocument`, or `ForAllCounters`.
-## ForCounter
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForCounter](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounter)
+ * [ForCounterOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcounterofdocument)
+ * [ForCountersOfDocument](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forcountersofdocument)
+ * [ForAllCounters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#forallcounters)
+ * [CounterChange and CounterChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)
+
+
+
+
Counter changes can be observed using `ForCounter` method. This will subscribe changes from all counters with a given name, no matter in what document counter was changed.
+
+
### Syntax
-
-
-{`IChangesObservable ForCounter(string counterName);
-`}
-
-
+```csharp
+IChangesObservable ForCounter(string counterName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -29,43 +46,45 @@ Counter changes can be observed using `ForCounter` method. This will subscribe c
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCounter("Likes")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForCounterOfDocument
+
Specific counter changes of a given document can be observed using `ForCounterOfDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForCounterOfDocument(string documentId, string counterName);
-`}
-
-
+```csharp
+IChangesObservable ForCounterOfDocument(string documentId, string counterName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -74,43 +93,45 @@ Specific counter changes of a given document can be observed using `ForCounterOf
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCounterOfDocument("companies/1-A", "Likes")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForCountersOfDocument
+
Counter changes of a specified document can be observed using `ForCountersOfDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForCountersOfDocument(string documentId);
-`}
-
-
+```csharp
+IChangesObservable ForCountersOfDocument(string documentId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -118,84 +139,117 @@ Counter changes of a specified document can be observed using `ForCountersOfDocu
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForCountersOfDocument("companies/1-A")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllCounters
+
Changes for all counters can be observed using `ForAllCounters` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForAllCounters();
-`}
-
-
+```csharp
+IChangesObservable ForAllCounters();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange)> | Observable that allows to add subscriptions to counter notifications. |
+| IChangesObservable<[CounterChange](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax)> | Observable that allows to add subscriptions to counter notifications. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllCounters()
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case CounterChangeTypes.Increment:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
-## CounterChange
+
+
-| Name | Type | Description |
+**The notification object delivered to subscribers when a counter changes.**
+
+```csharp
+class CounterChange
+{
+ CounterChangeTypes Type
+ string Name
+ long Value
+ string DocumentId
+ string CollectionName
+ string ChangeVector
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [CounterChangeTypes](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchangetypes) | Counter change type enum |
+| **Type** | [CounterChangeTypes](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx#counterchange-and-counterchangetypes-syntax) | Counter change type enum |
| **Name** | string | Counter name |
| **Value** | long | Counter value after the change |
| **DocumentId** | string | Counter document identifier |
-| **ChangeVector** | string | Counter's ChangeVector|
-
-
+| **CollectionName** | string | Document's collection name |
+| **ChangeVector** | string | Counter's ChangeVector |
-## CounterChangeTypes
+
+
+
+```csharp
+enum CounterChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ Increment,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -204,13 +258,7 @@ Changes for all counters can be observed using `ForAllCounters` method.
| **Delete** | `2` |
| **Increment** | `4` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
index 684d3c9531..7c3ce68b5a 100644
--- a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
+++ b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-document-changes-csharp.mdx
@@ -1,27 +1,44 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to document changes:
+
-- [ForDocument](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocument)
-- [ForDocumentsInCollection](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsincollection)
-- [ForDocumentsStartingWith](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsstartingwith)
-- [ForAllDocuments](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#foralldocuments)
+Subscribe to document changes using `ForDocument`, `ForDocumentsInCollection`,
+`ForDocumentsStartingWith`, or `ForAllDocuments`.
-## ForDocument
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForDocument](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocument)
+ * [ForDocumentsInCollection](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsincollection)
+ * [ForDocumentsStartingWith](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#fordocumentsstartingwith)
+ * [ForAllDocuments](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#foralldocuments)
+ * [DocumentChange and DocumentChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)
+
+
+
+
Single document changes can be observed using `ForDocument` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocument(string docId);
-`}
-
-
+```csharp
+IChangesObservable ForDocument(string docId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -29,48 +46,50 @@ Single document changes can be observed using `ForDocument` method.
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocument("employees/1")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case DocumentChangeTypes.Put:
// do something
break;
case DocumentChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForDocumentsInCollection
+
To observe all document changes in particular collection use `ForDocumentInCollection` method. This method filters documents by `@collection` metadata property value.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocumentsInCollection(string collectionName);
+```csharp
+IChangesObservable ForDocumentsInCollection(string collectionName);
IChangesObservable ForDocumentsInCollection();
-`}
-
-
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -78,51 +97,51 @@ IChangesObservable ForDocumentsInCollection();
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document collection name. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document collection name. |
Overload with `TEntity` type uses `Conventions.GetCollectionName` to get collection name.
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocumentsInCollection()
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
or
-
-
-{`string collectionName = store.Conventions.FindCollectionName(typeof(Employee));
+```csharp
+string collectionName = store.Conventions.FindCollectionName(typeof(Employee));
IDisposable subscription = store
.Changes()
.ForDocumentsInCollection(collectionName)
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
-## ForDocumentsStartingWith
+
To observe all document changes for documents with ID that contains given prefix use `ForDocumentsStartingWith` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForDocumentsStartingWith(string docIdPrefix);
-`}
-
-
+```csharp
+IChangesObservable ForDocumentsStartingWith(string docIdPrefix);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -130,66 +149,100 @@ To observe all document changes for documents with ID that contains given prefix
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for given document ID prefix. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for given document ID prefix. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForDocumentsStartingWith("employees/1") // employees/1, employees/10, employees/11, etc.
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
-## ForAllDocuments
+
To observe all document changes use `ForAllDocuments` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForAllDocuments();
-`}
-
-
+```csharp
+IChangesObservable ForAllDocuments();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)> | Observable that allows to add subscriptions to notifications for all documents. |
+| IChangesObservable<[DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for all documents. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllDocuments() // employees/1, orders/1, customers/1, etc.
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
+```
+
+
+
+
+
+
+
+
+**The notification object delivered to subscribers when a document changes.**
-## DocumentChange
+```csharp
+class DocumentChange
+{
+ DocumentChangeTypes Type
+ string Id
+ string CollectionName
+ string ChangeVector
+}
+```
+
-| Name | Type | Description |
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [DocumentChangeTypes](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchangetypes) | Document change type enum |
+| **Type** | [DocumentChangeTypes](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax) | Document change type enum |
| **Id** | string | Document identifier |
| **CollectionName** | string | Document's collection name |
-| **TypeName** | string | Type name |
-| **ChangeVector** | string | Document's ChangeVector|
+| **ChangeVector** | string | Document's ChangeVector |
-
-
-## DocumentChangeTypes
+
+
+
+```csharp
+enum DocumentChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ BulkInsertStarted,
+ BulkInsertEnded,
+ BulkInsertError,
+ DeleteOnTombstoneReplication,
+ Conflict,
+ Common,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -201,15 +254,9 @@ To observe all document changes use `ForAllDocuments` method.
| **BulkInsertError** | `16` |
| **DeleteOnTombstoneReplication** | `32` |
| **Conflict** | `64` |
-| **Common** | `Put & Delete` |
-
-
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
+| **Common** | `Put \| Delete` |
+
+
+
diff --git a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
index 59857984a7..8112c66b38 100644
--- a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
+++ b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-index-changes-csharp.mdx
@@ -1,46 +1,64 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-Following methods allow you to subscribe to index changes:
+
-- [ForIndex](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forindex)
-- [ForAllIndexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forallindexes)
+Subscribe to index changes using `ForIndex` or `ForAllIndexes`.
-## ForIndex
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
+ * [ForIndex](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forindex)
+ * [ForAllIndexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#forallindexes)
+ * [IndexChange and IndexChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)
+
+
+
+
Index changes for one index can be observed using `ForIndex` method.
+
+
### Syntax
-
-
-{`IChangesObservable ForIndex(string indexName);
-`}
-
-
+```csharp
+IChangesObservable ForIndex(string indexName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
| **indexName** | string | Name of an index for which notifications will be processed. |
-| Return value | |
+| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange)> | Observable that allows to add subscriptions to notifications for index with given name. |
+| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for index with given name. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForIndex("Orders/All")
.Subscribe(
change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case IndexChangeTypes.None:
//Do someting
break;
@@ -79,58 +97,91 @@ Index changes for one index can be observed using `ForIndex` method.
break;
default:
throw new ArgumentOutOfRangeException();
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllIndexes
+
Index changes for all indexex can be observed using `ForAllIndexes` method.
-| Return value | |
-| ------------- | ----- |
-| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange)> | Observable that allows to add subscriptions to notifications for all indexes. |
+
### Syntax
-
-
-{`IChangesObservable ForAllIndexes();
-`}
-
-
+```csharp
+IChangesObservable ForAllIndexes();
+```
+
+
+| Return Value | |
+| ------------- | ----- |
+| IChangesObservable<[IndexChange](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax)> | Observable that allows to add subscriptions to notifications for all indexes. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllIndexes()
- .Subscribe(change => Console.WriteLine("\{0\} on index \{1\}", change.Type, change.Name));
-`}
-
-
+ .Subscribe(change => Console.WriteLine("{0} on index {1}", change.Type, change.Name));
+```
+
+
-## IndexChange
+
-### Properties
+
+
-| Name | Type | Description |
-| ------------- | ------------- | ----- |
-| **Type** | [IndexChangeTypes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchangetypes) | Change type |
-| **Name** | string | Index name |
-| **Etag** | long? | Index Etag |
+**The notification object delivered to subscribers when an index changes.**
+```csharp
+class IndexChange
+{
+ IndexChangeTypes Type
+ string Name
+}
+```
+
+| Property | Type | Description |
+| ------------- | ------------- | ----- |
+| **Type** | [IndexChangeTypes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx#indexchange-and-indexchangetypes-syntax) | Change type |
+| **Name** | string | Index name |
-## IndexChangeTypes
+
+
+
+```csharp
+enum IndexChangeTypes
+{
+ None,
+ BatchCompleted,
+ IndexAdded,
+ IndexRemoved,
+ IndexDemotedToIdle,
+ IndexPromotedFromIdle,
+ IndexDemotedToDisabled,
+ IndexMarkedAsErrored,
+ SideBySideReplace,
+ Renamed,
+ IndexPaused,
+ LockModeChanged,
+ PriorityChanged,
+ RollingIndexChanged,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -143,17 +194,13 @@ Index changes for all indexex can be observed using `ForAllIndexes` method.
| **IndexDemotedToDisabled** | `256` |
| **IndexMarkedAsErrored** | `512` |
| **SideBySideReplace** | `1024` |
+| **Renamed** | `2048` |
| **IndexPaused** | `4096` |
| **LockModeChanged** | `8192` |
| **PriorityChanged** | `16384` |
+| **RollingIndexChanged** | `65536` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
index bee95aa63c..8811dcd0b1 100644
--- a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
+++ b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-operation-changes-csharp.mdx
@@ -1,56 +1,74 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
-The following methods allow you to subscribe to operation changes:
+
+
+Subscribe to operation changes using `ForOperationId` or `ForAllOperations`.
+
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
-- [ForOperationId](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foroperationid)
-- [ForAllOperations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foralloperations)
+* In this article:
+ * [ForOperationId](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foroperationid)
+ * [ForAllOperations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#foralloperations)
+ * [Syntax](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)
-## ForOperationId
+
+
+
Operation changes for one operation can be observed using the `ForOperationId` method.
Please note that from RavenDB 6.2 on, operation changes can be tracked only on a **specific node**.
-The purpose of this change is to improve results consistency, as an operation may behave very differently
-on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
+The purpose of this change is to improve results consistency, as an operation may behave very differently
+on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
the operation fails over from one node to another.
-Tracking operations will therefore be possible only if the `Changes` API was
-[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
+Tracking operations will therefore be possible only if the `Changes` API was
+[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
tracking to a single node: `store.Changes(dbName, nodeTag)`
-### Syntax
+
-
-
-{`IChangesObservable ForOperationId(long operationId);
-`}
-
-
+### ForOperationId syntax
+
+```csharp
+IChangesObservable ForOperationId(long operationId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
| **operationId** | long | ID of an operation for which notifications will be processed. |
-| Return value | |
+| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationchange)> | Observable that allows you to add subscriptions to notifications for an operation with a given ID. |
+| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)> | Observable that allows you to add subscriptions to notifications for an operation with a given ID. |
+
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes(dbName, nodeTag)
.ForOperationId(operationId)
.Subscribe(
change =>
- \{
+ {
switch (change.State.Status)
- \{
+ {
case OperationStatus.InProgress:
//Do Something
break;
@@ -65,90 +83,132 @@ tracking to a single node: `store.Changes(dbName, nodeTag)`
break;
default:
throw new ArgumentOutOfRangeException();
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllOperations
+
Operations changes for all Operations can be observed using the `ForAllOperations` method.
Please note that from RavenDB 6.2 on, operation changes can be tracked only on a **specific node**.
-The purpose of this change is to improve results consistency, as an operation may behave very differently
-on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
+The purpose of this change is to improve results consistency, as an operation may behave very differently
+on different nodes and cross-cluster tracking of an operation may become confusing and ineffective if
the operation fails over from one node to another.
-Tracking operations will therefore be possible only if the `Changes` API was
-[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
+Tracking operations will therefore be possible only if the `Changes` API was
+[opened](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api) using a method that limits
tracking to a single node: `store.Changes(dbName, nodeTag)`
+
+
+### ForAllOperations syntax
+
+```csharp
+IChangesObservable ForAllOperations();
+```
+
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationchange)> | Observable that allows to add subscriptions to notifications for all operations. |
+| IChangesObservable<[OperationStatusChange](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax)> | Observable that allows to add subscriptions to notifications for all operations. |
-### Syntax
-
-
-
-{`IChangesObservable ForAllOperations();
-`}
-
-
+
+
### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes(dbName, nodeTag)
.ForAllOperations()
- .Subscribe(change => Console.WriteLine("Operation #\{1\} reports progress: \{0\}", change.State.Progress.ToJson(), change.OperationId));
-`}
-
-
-
+ .Subscribe(change => Console.WriteLine("Operation #{1} reports progress: {0}", change.State.Progress.ToJson(), change.OperationId));
+```
+
-## OperationChange
+
-### Properties
-
-| Name | Type | Description |
-| ------------- | ------------- | ----- |
-| **State** | [OperationState](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationstate) | Operation state |
-| **OperationId** | long | Operation ID |
+
+
+
+**The notification object delivered to subscribers when an operation changes.**
-## OperationState
+```csharp
+class OperationStatusChange
+{
+ long OperationId
+ OperationState State
+}
+```
+
-### Members
-
-| Name | Type | Description |
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Result** | [IOperationResult](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationresult) | Operation result |
-| **Progress** | IOperationProgress| Instance of IOperationProgress (json representation of the progress) |
-| **Status** | [OperationStatus](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#operationstatus) | Operation status |
-
-
-## OperationResult
+| **OperationId** | long | Operation ID |
+| **State** | [OperationState](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation state |
-### Members
+
+
+
+```csharp
+class OperationState
+{
+ IOperationResult Result
+ IOperationProgress Progress
+ OperationStatus Status
+}
+```
+
+
+| Property | Type | Description |
+| ------------- | ------------- | ----- |
+| **Result** | [IOperationResult](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation result |
+| **Progress** | IOperationProgress | Instance of IOperationProgress (json representation of the progress) |
+| **Status** | [OperationStatus](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx#syntax) | Operation status |
-| Name | Type | Description |
+
+
+
+
+
+
+```csharp
+interface IOperationResult
+{
+ string Message
+ bool ShouldPersist
+ bool CanMerge
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
| **Message** | string | Operation message |
| **ShouldPersist** | bool | determine whether or not the result should be saved in the storage |
+| **CanMerge** | bool | Whether this result can be merged with another operation result |
-
-## OperationStatus
-
-### OperationStatus (enum)
+
+
+
+```csharp
+enum OperationStatus
+{
+ InProgress,
+ Completed,
+ Faulted,
+ Canceled,
+}
+```
+
| Name | Description |
| ---- | ----- |
@@ -157,12 +217,7 @@ tracking to a single node: `store.Changes(dbName, nodeTag)`
| **Faulted** | `Indicates that the operation is faulted` |
| **Canceled** | `Indicates that the operation has been Canceled` |
+
+
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
index f4349a81fd..76b6002940 100644
--- a/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
+++ b/versioned_docs/version-7.1/client-api/changes/content/_how-to-subscribe-to-time-series-changes-csharp.mdx
@@ -1,7 +1,8 @@
import Admonition from '@theme/Admonition';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
+import ContentFrame from "@site/src/components/ContentFrame";
@@ -14,25 +15,36 @@ import CodeBlock from '@theme/CodeBlock';
* `ForAllTimeSeries`
Track **all** time series
-* In this page:
+
+The `Subscribe` method on the observable these methods return accepts only an `IObserver` object
+by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
* [ForTimeSeries](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#fortimeseries)
* [ForTimeSeriesOfDocument](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#fortimeseriesofdocument)
* [ForAllTimeSeries](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#foralltimeseries)
+ * [TimeSeriesChange and TimeSeriesChangeTypes syntax](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)
-## ForTimeSeries
-Subscribe to changes in **all time-series with a given name**, no matter which document they belong to,
-using the `ForTimeSeries` method.
+
-#### Syntax
+Subscribe to changes in **all time-series with a given name**, no matter which document they belong to,
+using the `ForTimeSeries` method.
-
-
-{`IChangesObservable ForTimeSeries(string timeSeriesName);
-`}
-
-
+
+
+### Syntax
+
+```csharp
+IChangesObservable ForTimeSeries(string timeSeriesName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -40,49 +52,53 @@ using the `ForTimeSeries` method.
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
-#### Example
+
+
-
-
-{`IDisposable subscription = store
+### Example
+
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeries("Likes")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForTimeSeriesOfDocument
+
-Use `ForTimeSeriesOfDocument` to subscribe to changes in **time series of a chosen document**.
+Use `ForTimeSeriesOfDocument` to subscribe to changes in **time series of a chosen document**.
* Two overload methods allow you to
* Track **a specific** time series of the chosen document
* Track **any** time series of the chosen document
+
+
+
### Overload #1
-Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific time** series of the chosen document.
+
+Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific time** series of the chosen document.
#### Syntax
-
-
-{`IChangesObservable ForTimeSeriesOfDocument(string documentId, string timeSeriesName);
-`}
-
-
+```csharp
+IChangesObservable ForTimeSeriesOfDocument(string documentId, string timeSeriesName);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -91,39 +107,39 @@ Use this `ForTimeSeriesOfDocument` overload to track changes in a **specific tim
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
#### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeriesOfDocument("companies/1-A", "Likes")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
### Overload #2
-Use this `ForTimeSeriesOfDocument` overload to track changes in **any time series** of the chosen document.
+
+Use this `ForTimeSeriesOfDocument` overload to track changes in **any time series** of the chosen document.
#### Syntax
-
-
-{`IChangesObservable ForTimeSeriesOfDocument(string documentId);
-`}
-
-
+```csharp
+IChangesObservable ForTimeSeriesOfDocument(string documentId);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -131,76 +147,96 @@ Use this `ForTimeSeriesOfDocument` overload to track changes in **any time serie
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
#### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForTimeSeriesOfDocument("companies/1-A")
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
-## ForAllTimeSeries
+
-Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
+Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
-#### Syntax
+
-
-
-{`IChangesObservable ForAllTimeSeries();
-`}
-
-
+### Syntax
+
+```csharp
+IChangesObservable ForAllTimeSeries();
+```
+
| Return Value | |
| ------------- | ----- |
-| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange)> | Observable that allows to add subscriptions to time series notifications. |
+| IChangesObservable<[TimeSeriesChange](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax)> | Observable that allows to add subscriptions to time series notifications. |
-#### Example
+
+
+
+### Example
-
-
-{`IDisposable subscription = store
+```csharp
+IDisposable subscription = store
.Changes()
.ForAllTimeSeries()
.Subscribe
(change =>
- \{
+ {
switch (change.Type)
- \{
+ {
case TimeSeriesChangeTypes.Delete:
// do something
break;
- \}
- \});
-`}
-
-
+ }
+ });
+```
+
+
+
+
+
+
+
-## TimeSeriesChange
+**The notification object delivered to subscribers when a time series changes.**
-| Name | Type | Description |
+```csharp
+class TimeSeriesChange
+{
+ TimeSeriesChangeTypes Type
+ string Name
+ string DocumentId
+ string CollectionName
+ DateTime From
+ DateTime To
+ string ChangeVector
+}
+```
+
+
+| Property | Type | Description |
| ------------- | ------------- | ----- |
-| **Type** | [TimeSeriesChangeTypes](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschangetypes) | Time series change type enum |
+| **Type** | [TimeSeriesChangeTypes](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx#timeserieschange-and-timeserieschangetypes-syntax) | Time series change type enum |
| **Name** | string | Time Series Name |
| **DocumentId** | string | Time series Document Identifier |
| **CollectionName** | string | Time series document Collection Name |
@@ -208,9 +244,19 @@ Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
| **To** | DateTime | Time series values To date |
| **ChangeVector** | string | Time series Change Vector |
-
-
-## TimeSeriesChangeTypes
+
+
+
+```csharp
+enum TimeSeriesChangeTypes
+{
+ None,
+ Put,
+ Delete,
+ Mixed,
+}
+```
+
| Name | Value |
| ---- | ----- |
@@ -219,13 +265,7 @@ Subscribe to changes in **all time-series** using the `ForAllTimeSeries` method.
| **Delete** | `2` |
| **Mixed** | `3` |
+
+
-
-## Remarks
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
+
diff --git a/versioned_docs/version-7.1/client-api/changes/content/_what-is-changes-api-csharp.mdx b/versioned_docs/version-7.1/client-api/changes/content/_what-is-changes-api-csharp.mdx
index 240dac83d6..4df96de1ce 100644
--- a/versioned_docs/version-7.1/client-api/changes/content/_what-is-changes-api-csharp.mdx
+++ b/versioned_docs/version-7.1/client-api/changes/content/_what-is-changes-api-csharp.mdx
@@ -1,7 +1,5 @@
import Admonition from '@theme/Admonition';
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-import CodeBlock from '@theme/CodeBlock';
+import Panel from "@site/src/components/Panel";
@@ -11,33 +9,36 @@ import CodeBlock from '@theme/CodeBlock';
* Using the Changes API allows you to notify users of various changes without requiring
any expensive polling.
-* In this page:
+
+The `Subscribe` method on the observables the Changes API returns accepts only an `IObserver`
+object by default.
+To instead subscribe with a delegate, like the `change => ...` lambda used in the examples below,
+add the [System.Reactive](https://www.nuget.org/packages/System.Reactive/) package to your project.
+This adds `Subscribe` overloads that take delegates, including ones with error and
+completion handlers.
+
+
+* In this article:
* [Accessing Changes API](../../../client-api/changes/what-is-changes-api.mdx#accessing-changes-api)
* [Connection interface](../../../client-api/changes/what-is-changes-api.mdx#connection-interface)
* [Subscribing](../../../client-api/changes/what-is-changes-api.mdx#subscribing)
* [Unsubscribing](../../../client-api/changes/what-is-changes-api.mdx#unsubscribing)
- * [FAQ](../../../client-api/changes/what-is-changes-api.mdx#faq)
- * [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
- * [Changes API and Method Overloads](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-method-overloads)
+ * [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
* [Changes API -vs- Data Subscriptions](../../../client-api/changes/what-is-changes-api.mdx#changes-api--vs--data-subscriptions)
+
-## Accessing Changes API
+
+
The changes subscription is accessible by a document store through its `IDatabaseChanges`
or `ISingleNodeDatabaseChanges` interfaces.
-
-
-{`IDatabaseChanges Changes(string database = null);
-`}
-
-
-
-
-{`ISingleNodeDatabaseChanges Changes(string database, string nodeTag);
-`}
-
-
+```csharp
+IDatabaseChanges Changes(string database = null);
+
+ISingleNodeDatabaseChanges Changes(string database, string nodeTag);
+```
+
| Parameters | | |
| ------------- | ------------- | ----- |
@@ -57,19 +58,18 @@ or `ISingleNodeDatabaseChanges` interfaces.
the second overload, passing both a database name and a node tag: `store.Changes(dbName, nodeTag)`
+
-
-## Connection interface
+
`IDatabaseChanges` inherits from `IConnectableChanges` interface that represent the connection.
-
-
-{`public interface IConnectableChanges : IDisposable
+```csharp
+public interface IConnectableChanges : IDisposable
where TChanges : IDatabaseChanges
-\{
+{
// returns state of the connection
- bool Connected \{ get; \}
+ bool Connected { get; }
// A task that ensures that the connection to the server was established.
Task EnsureConnectedNow();
@@ -79,14 +79,12 @@ or `ISingleNodeDatabaseChanges` interfaces.
//An action to take if an error occured in the connection to the server
event Action OnError;
-\}
-`}
-
-
-
+}
+```
+
-## Subscribing
+
To receive notifications regarding server-side events, subscribe using one of the following methods.
@@ -133,51 +131,40 @@ To receive notifications regarding server-side events, subscribe using one of th
* a **specific time series** of a given document (by Doc ID and Time Series Name)
* **any time series** of a given document (by Doc ID)
+
-
-## Unsubscribing
+
To end a subscription (stop listening for particular notifications) you must
`Dispose` of the subscription.
-
-
-{`IDatabaseChanges changes = store.Changes();
+```csharp
+IDatabaseChanges changes = store.Changes();
await changes.EnsureConnectedNow();
var subscription = changes
.ForAllDocuments()
- .Subscribe(change => Console.WriteLine("\{0\} on document \{1\}", change.Type, change.Id));
+ .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
try
-\{
+{
// application code here
-\}
+}
finally
-\{
+{
if (subscription != null)
subscription.Dispose();
-\}
-`}
-
-
-
+}
+```
+
-## FAQ
-
-#### Changes API and Database Timeout
+
One or more open Changes API connections will prevent a database from becoming
idle and unloaded, regardless of [the configuration value for database idle timeout](../../../server/configuration/database-configuration.mdx#databasesmaxidletimeinsec).
-#### Changes API and Method Overloads
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
+
-
-## Changes API -vs- Data Subscriptions
+
**Changes API** and [Data Subscription](../../../client-api/data-subscriptions/what-are-data-subscriptions.mdx)
are services that a RavenDB Server provides subscribing clients.
@@ -189,7 +176,7 @@ to their subscribers.
took place on the server, without receiving the actual data entities
affected by these events.
For the modification of a document, for example, the client will receive
- a [DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange)
+ a [DocumentChange](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx#documentchange-and-documentchangetypes-syntax)
object with details like the document's ID and collection name.
* The server does **not** keep track of sent notifications or
@@ -208,3 +195,5 @@ to their subscribers.
| What can the server Track | [Documents](../../../client-api/data-subscriptions/what-are-data-subscriptions.mdx#documents-processing)
[Revisions](../../../client-api/data-subscriptions/advanced-topics/subscription-with-revisioning.mdx)
[Counters](../../../client-api/data-subscriptions/creation/examples.mdx#including-counters)
Time Series | [Documents](../../../client-api/changes/how-to-subscribe-to-document-changes.mdx)
[Indexes](../../../client-api/changes/how-to-subscribe-to-index-changes.mdx)
[Operations](../../../client-api/changes/how-to-subscribe-to-operation-changes.mdx)
[Counters](../../../client-api/changes/how-to-subscribe-to-counter-changes.mdx)
[Time Series](../../../client-api/changes/how-to-subscribe-to-time-series-changes.mdx) |
| What can the server Deliver | Documents
Revisions
Counters
Time Series | Notifications |
| Management | Managed by the Server | Managed by the Client |
+
+
diff --git a/versioned_docs/version-7.1/client-api/changes/content/_what-is-changes-api-nodejs.mdx b/versioned_docs/version-7.1/client-api/changes/content/_what-is-changes-api-nodejs.mdx
index 2dc3ced34c..6b6dd1c04b 100644
--- a/versioned_docs/version-7.1/client-api/changes/content/_what-is-changes-api-nodejs.mdx
+++ b/versioned_docs/version-7.1/client-api/changes/content/_what-is-changes-api-nodejs.mdx
@@ -18,7 +18,6 @@ import CodeBlock from '@theme/CodeBlock';
* [Unsubscribing](../../../client-api/changes/what-is-changes-api.mdx#unsubscribing)
* [FAQ](../../../client-api/changes/what-is-changes-api.mdx#faq)
* [Changes API and Database Timeout](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-database-timeout)
- * [Changes API and Method Overloads](../../../client-api/changes/what-is-changes-api.mdx#changes-api-and-method-overloads)
* [Changes API -vs- Data Subscriptions](../../../client-api/changes/what-is-changes-api.mdx#changes-api--vs--data-subscriptions)
## Accessing Changes API
@@ -110,14 +109,6 @@ try \{
One or more open Changes API connections will prevent a database from becoming
idle and unloaded, regardless of [the configuration value for database idle timeout](../../../server/configuration/database-configuration.mdx#databasesmaxidletimeinsec).
-#### Changes API and Method Overloads
-
-
-To get more method overloads, especially ones supporting **delegates**, please add the
-[System.Reactive.Core](https://www.nuget.org/packages/System.Reactive.Core/) package to your project.
-
-
-
## Changes API -vs- Data Subscriptions