diff --git a/docs/data-archival/api-studio-quick-links/_category_.json b/docs/data-archival/api-studio-quick-links/_category_.json new file mode 100644 index 0000000000..522bf0fde1 --- /dev/null +++ b/docs/data-archival/api-studio-quick-links/_category_.json @@ -0,0 +1,4 @@ +{ + "position": 7, + "label": "API/Studio Quick Links" +} \ No newline at end of file diff --git a/docs/data-archival/api-studio-quick-links/client-api-references.mdx b/docs/data-archival/api-studio-quick-links/client-api-references.mdx new file mode 100644 index 0000000000..50365ef59e --- /dev/null +++ b/docs/data-archival/api-studio-quick-links/client-api-references.mdx @@ -0,0 +1,30 @@ +--- +title: "Client API References" +sidebar_label: "Client API References" +sidebar_position: 1 +--- + +import Admonition from '@theme/Admonition'; + + + +Refer to the following links for managing data archival via the Client API: + +* **Enable archiving**: + [Enable archiving - from the Client API](../../data-archival/enable-data-archiving#enable-archiving-from-the-client-api) + +* **Schedule archiving**: + [Schedule a SINGLE document for archiving - from the Client API](../../data-archival/schedule-document-archiving#schedule-a-single-document-for-archiving-from-the-client-api) + [Schedule MULTIPLE documents for archiving - from the Client API](../../data-archival/schedule-document-archiving#schedule-multiple-documents-for-archiving-from-the-client-api) + +* **Unarchive**: + [Unarchive documents - from the Client API](../../data-archival/unarchiving-documents#unarchive-documents-from-the-client-api) + +* **Archiving and other features**: + [Archived documents and indexing](../../data-archival/archived-documents-and-other-features#archived-documents-and-indexing) + [Archived documents and subscriptions](../../data-archival/archived-documents-and-other-features#archived-documents-and-subscriptions) + [Archived documents and smuggler (export/import)](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-smuggler-export-import) + [Archived documents and expiration](../../data-archival/archived-documents-and-other-features#archived-documents-and-expiration) + [Archived documents and ETL](../../data-archival/archived-documents-and-other-features#archived-documents-and-etl) + + diff --git a/docs/data-archival/api-studio-quick-links/studio-references.mdx b/docs/data-archival/api-studio-quick-links/studio-references.mdx new file mode 100644 index 0000000000..73d14fd45f --- /dev/null +++ b/docs/data-archival/api-studio-quick-links/studio-references.mdx @@ -0,0 +1,30 @@ +--- +title: "Studio References" +sidebar_label: "Studio References" +sidebar_position: 0 +--- + +import Admonition from '@theme/Admonition'; + + + +Refer to the following links for managing data archival via Studio: + +* **Overview**: + [The archived document](../../data-archival/overview#the-archived-document) + +* **Enable & schedule**: + [Enable archiving](../../data-archival/enable-data-archiving#enable-archiving-from-the-studio) + [Schedule a single document for archiving](../../data-archival/enable-data-archiving#enable-archiving-from-the-studio) + [Schedule multiple documents for archiving](../../data-archival/schedule-document-archiving#schedule-multiple-documents-for-archiving-from-the-studio) + +* **Unarchive**: + [Unarchive documents](../../data-archival/unarchiving-documents#unarchive-documents-from-the-studio) + +* **Archiving and other features**: + [Configure how a static index handles archived documents](../../data-archival/archived-documents-and-other-features#configuring-archived-document-processing-for-a-static-index---from-the-studio) + [Configure how a subscription task handles archived documents](../../data-archival/archived-documents-and-other-features#configuring-archived-document-processing-for-a-data-subscription-task----from-the-studio) + [Export archived documents](../../data-archival/archived-documents-and-other-features#export-archived-documents---from-the-studio) + [Import archived documents](../../data-archival/archived-documents-and-other-features#import-archived-documents---from-the-studio) + + diff --git a/docs/data-archival/archived-documents-and-other-features.mdx b/docs/data-archival/archived-documents-and-other-features.mdx index 6cf644a121..2d3140c6fe 100644 --- a/docs/data-archival/archived-documents-and-other-features.mdx +++ b/docs/data-archival/archived-documents-and-other-features.mdx @@ -1,15 +1,14 @@ --- title: "Archived Documents and Other Features" -sidebar_label: Archived Documents and Other Features -sidebar_position: 3 +sidebar_label: "Archived Documents and Other Features" +sidebar_position: 4 supported_languages: ["csharp"] --- import LanguageSwitcher from "@site/src/components/LanguageSwitcher"; import LanguageContent from "@site/src/components/LanguageContent"; -import ArchivedDocumentsAndOtherFeaturesCsharp from './_archived-documents-and-other-features-csharp.mdx'; - +import ArchivedDocumentsAndOtherFeaturesCsharp from './content/_archived-documents-and-other-features-csharp.mdx'; diff --git a/docs/data-archival/configuration.mdx b/docs/data-archival/configuration.mdx new file mode 100644 index 0000000000..1e81712b09 --- /dev/null +++ b/docs/data-archival/configuration.mdx @@ -0,0 +1,85 @@ +--- +title: "Configuration" +sidebar_label: "Configuration" +sidebar_position: 6 +--- + +import Admonition from '@theme/Admonition'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; +import LanguageSwitcher from "@site/src/components/LanguageSwitcher"; +import LanguageContent from "@site/src/components/LanguageContent"; +import ContentFrame from '@site/src/components/ContentFrame'; +import Panel from '@site/src/components/Panel'; + +# Data archival configuration + + + +* For an overview of what configuration options are and how they can be applied, + see the [Configuration Overview](../server/configuration/configuration-options) article. + +* The following configuration options are available for data archival: + * [Indexing.Static.ArchivedDataProcessingBehavior](../data-archival/configuration#indexingstaticarchiveddataprocessingbehavior) + * [Indexing.Auto.ArchivedDataProcessingBehavior](../data-archival/configuration#indexingautoarchiveddataprocessingbehavior) + * [Subscriptions.ArchivedDataProcessingBehavior](../data-archival/configuration#subscriptionsarchiveddataprocessingbehavior) + + + +--- + + + +## Indexing.Static.ArchivedDataProcessingBehavior + +* Set the default processing behavior for archived documents in static indexes. +* This setting applies only to static indexes that use _Documents_ as their data source. + It does not apply to indexes based on _Time Series_ or _Counters_, which default to `IncludeArchived`. + +--- + +- **Type**: `enum ArchivedDataProcessingBehavior`: + * `ExcludeArchived`: only non-archived documents are processed by the index. + * `IncludeArchived`: both archived and non-archived documents are processed by the index. + * `ArchivedOnly`: only archived documents are processed by the index. + +- **Default**: `ExcludeArchived` + +- **Scope**: Server-wide, or per database + + + + + +## Indexing.Auto.ArchivedDataProcessingBehavior + +The default processing behavior for archived documents in auto-indexes. + +- **Type**: `enum ArchivedDataProcessingBehavior`: + * `ExcludeArchived`: only non-archived documents are processed by the index. + * `IncludeArchived`: both archived and non-archived documents are processed by the index. + * `ArchivedOnly`: only archived documents are processed by the index. + +- **Default**: `ExcludeArchived` + +- **Scope**: Server-wide, or per database + + + + + +## Subscriptions.ArchivedDataProcessingBehavior + +The default processing behavior for archived documents in a subscription query. + +- **Type**: `enum ArchivedDataProcessingBehavior`: + * `ExcludeArchived`: only non-archived documents are processed by the subscription query. + * `IncludeArchived`: both archived and non-archived documents are processed by the subscription query. + * `ArchivedOnly`: only archived documents are processed by the subscription query. + +- **Default**: `ExcludeArchived` + +- **Scope**: Server-wide, or per database + + \ No newline at end of file diff --git a/versioned_docs/version-7.1/data-archival/_archived-documents-and-other-features-csharp.mdx b/docs/data-archival/content/_archived-documents-and-other-features-csharp.mdx similarity index 67% rename from versioned_docs/version-7.1/data-archival/_archived-documents-and-other-features-csharp.mdx rename to docs/data-archival/content/_archived-documents-and-other-features-csharp.mdx index 833b403537..426aa3be51 100644 --- a/versioned_docs/version-7.1/data-archival/_archived-documents-and-other-features-csharp.mdx +++ b/docs/data-archival/content/_archived-documents-and-other-features-csharp.mdx @@ -2,10 +2,12 @@ import Admonition from '@theme/Admonition'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ContentFrame from '@site/src/components/ContentFrame'; +import Panel from '@site/src/components/Panel'; -* Once you have archived documents in your database (see how to [enable](../data-archival/enable-data-archiving.mdx) and [schedule](../data-archival/schedule-document-archiving.mdx) document archiving), +* Once you have archived documents in your database (see how to [enable](../../data-archival/enable-data-archiving.mdx) and [schedule](../../data-archival/schedule-document-archiving.mdx) document archiving), RavenDB features can detect these documents and handle them in different ways. * Some features, like indexes and data subscriptions, provide native support for configuring whether to: @@ -20,20 +22,22 @@ import CodeBlock from '@theme/CodeBlock'; * Limiting processing to either archived or non-archived documents may improve performance by reducing workload and transfer volume. * Learn more below about how various RavenDB features interact with archived documents. + * In this article: - * [Archived documents and indexing](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-indexing) - * [Archived documents and querying](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-querying) - * [Archived documents and data subscriptions](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-subscriptions) - * [Archived documents and document extensions](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-document-extensions) - * [Archived documents and smuggler (export/import)](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-smuggler-(export/import)) - * [Archived documents and expiration](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-expiration) - * [Archived documents and ETL](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-etl) - * [Archived documents and backup](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-backup) - * [Archived documents and replication](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-replication) - * [Archived documents and patching](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-patching) + * [Archived documents and indexing](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-indexing) + * [Archived documents and querying](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-querying) + * [Archived documents and data subscriptions](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-subscriptions) + * [Archived documents and document extensions](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-document-extensions) + * [Archived documents and smuggler (export/import)](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-smuggler-export-import) + * [Archived documents and expiration](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-expiration) + * [Archived documents and ETL](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-etl) + * [Archived documents and backup](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-backup) + * [Archived documents and replication](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-replication) + * [Archived documents and patching](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-patching) -## Archived documents and indexing + + * Indexing performance may decline as the database grows, since a larger number of documents increases indexing load, expands index size, and can eventually reduce query speed. * Archiving documents and excluding them from indexing can be an effective way to maintain performance. @@ -42,38 +46,42 @@ import CodeBlock from '@theme/CodeBlock'; * **Configuring indexing behavior - Static indexes**: * **At the database level or server-wide**: To control whether static indexes process archived documents from the source collection, - set the [Indexing.Static.ArchivedDataProcessingBehavior](../server/configuration/indexing-configuration.mdx#indexingstaticarchiveddataprocessingbehavior) + set the [Indexing.Static.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#indexingstaticarchiveddataprocessingbehavior) configuration key at either the database level or server-wide (default: `ExcludeArchived`). - * Note that this setting applies only to static-indexes that are using _Documents_ as their data source. + * Note that this setting applies only to static-indexes that are using _Documents_ as their data source. This global configuration does Not apply to static-indexes based on _Time Series_ or _Counters_, which default to `IncludeArchived`. * **Per index**: - You can override this global behavior per-index directly in the index definition, using the Client API from the Studio - (see the examples below). + You can override this global behavior per-index directly in the index definition, + using the Client API or from the Studio (see the examples below). * **Configuring indexing behavior - Auto indexes:** * **At the database level or server-wide**: To control whether auto-indexes process archived documents at the database level or server-wide, - set the [Indexing.Auto.ArchivedDataProcessingBehavior](../server/configuration/indexing-configuration.mdx#indexingautoarchiveddataprocessingbehavior) configuration key (default `ExcludeArchived`). + set the [Indexing.Auto.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#indexingautoarchiveddataprocessingbehavior) configuration key (default `ExcludeArchived`). * **Per index**: Unlike static indexes, you cannot configure this behavior per auto-index, because dynamic queries (which trigger auto-index creation) do not provide a way to control this setting. + * The available configuration options are: * `ExcludeArchived`: only non-archived documents are processed by the index. * `IncludeArchived`: both archived and non-archived documents are processed by the index. * `ArchivedOnly`: only archived documents are processed by the index. -##### Configuring archived document processing for a static index - from the Client API -You can configure how a static index handles archived documents when creating the index using the Client API. -This setting will **override** the global configuration defined by the [Indexing.Static.ArchivedDataProcessingBehavior](../server/configuration/indexing-configuration.mdx#indexingstaticarchiveddataprocessingbehavior) configuration key. +--- + +### Configuring archived document processing for a static index - from the Client API - +You can configure how a static index handles archived documents when creating the index using the Client API. +This setting will **override** the global configuration defined by the [Indexing.Static.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#indexingstaticarchiveddataprocessingbehavior) configuration key. + + Example: - -{`public class Orders_ByOrderDate : +```csharp +public class Orders_ByOrderDate : AbstractIndexCreationTask { public class IndexEntry @@ -89,19 +97,19 @@ Example: OrderDate = order.OrderedAt }; + // Override global configuration - // Configure whether the index should process data from archived documents: // ======================================================================== ArchivedDataProcessingBehavior = - // You can set to 'ExcludeArchived', 'IncludeArchived, or 'ArchivedOnly' - Raven.Client.Documents.DataArchival.ArchivedDataProcessingBehavior.IncludeArchived; + // You can set to 'ExcludeArchived', 'IncludeArchived, or 'ArchivedOnly' + Raven.Client.Documents.DataArchival.ArchivedDataProcessingBehavior.IncludeArchived; } } -`} - +``` - -{`public class Orders_ByOrderDate_JS : AbstractJavaScriptIndexCreationTask +```csharp +public class Orders_ByOrderDate_JS : AbstractJavaScriptIndexCreationTask { public Orders_ByOrderDate_JS() { @@ -114,27 +122,28 @@ Example: })" }; + // Override global configuration - // Configure whether the index should process data from archived documents: // ======================================================================== ArchivedDataProcessingBehavior = - // Can set the to 'ExcludeArchived', 'IncludeArchived, or 'ArchivedOnly' - Raven.Client.Documents.DataArchival.ArchivedDataProcessingBehavior.IncludeArchived; + // Can set the to 'ExcludeArchived', 'IncludeArchived, or 'ArchivedOnly' + Raven.Client.Documents.DataArchival.ArchivedDataProcessingBehavior.IncludeArchived; } } -`} - +``` - -{`var indexDefinition = new IndexDefinitionBuilder() +```csharp +var indexDefinition = new IndexDefinitionBuilder() { Map = orders => from order in orders select new { order.OrderedAt } } - .ToIndexDefinition(new DocumentConventions()); +.ToIndexDefinition(new DocumentConventions()); indexDefinition.Name = "Orders/ByOrderDate"; +// Override global configuration - // Configure whether the index should process data from archived documents: // ======================================================================== indexDefinition.ArchivedDataProcessingBehavior = @@ -142,13 +151,13 @@ indexDefinition.ArchivedDataProcessingBehavior = ArchivedDataProcessingBehavior.IncludeArchived; store.Maintenance.Send(new PutIndexesOperation(indexDefinition)); -`} - +``` - + - - + + + When a static-index is configured to include **both** archived and non-archived documents in its processing, you can also apply custom logic based on the presence of the `@archived` metadata property. @@ -157,8 +166,8 @@ For example: - -{`public class Orders_ByArchivedStatus : +```csharp +public class Orders_ByArchivedStatus : AbstractIndexCreationTask { public class IndexEntry @@ -193,15 +202,14 @@ For example: }; ArchivedDataProcessingBehavior = - Raven.Client.Documents.DataArchival.ArchivedDataProcessingBehavior.IncludeArchived; + Raven.Client.Documents.DataArchival.ArchivedDataProcessingBehavior.IncludeArchived; } } -`} - +``` - -{`public class Orders_ByArchivedStatus_JS : AbstractJavaScriptIndexCreationTask +```csharp +public class Orders_ByArchivedStatus_JS : AbstractJavaScriptIndexCreationTask { public Orders_ByArchivedStatus_JS() { @@ -225,15 +233,14 @@ For example: }; ArchivedDataProcessingBehavior = - Raven.Client.Documents.DataArchival.ArchivedDataProcessingBehavior.IncludeArchived; + Raven.Client.Documents.DataArchival.ArchivedDataProcessingBehavior.IncludeArchived; } } -`} - +``` - -{`var indexDefinition = new IndexDefinition +```csharp +var indexDefinition = new IndexDefinition { Name = "Orders/ByArchivedStatus", @@ -255,20 +262,22 @@ For example: }; store.Maintenance.Send(new PutIndexesOperation(indexDefinition)); -`} - +``` - + - -##### Configuring archived document processing for a static index - from the Studio + + +--- + +### Configuring archived document processing for a static index - from the Studio You can configure how a static index handles archived documents directly from the Studio. -This setting will **override** the global configuration defined by the [Indexing.Static.ArchivedDataProcessingBehavior](../server/configuration/indexing-configuration.mdx#indexingstaticarchiveddataprocessingbehavior) configuration key. +This setting will **override** the global configuration defined by the [Indexing.Static.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdxindexingstaticarchiveddataprocessingbehavior) configuration key. -![Configure index](./assets/configure-static-index.png) +![Configure index](../assets/configure-static-index.png) -1. Open the [Indexes list view](../studio/database/indexes/indexes-list-view.mdx) and select the index you want to configure, +1. Open the [Indexes list view](../../studio/database/indexes/indexes-list-view.mdx) and select the index you want to configure, or create a new index. 2. Scroll down and open the **Archived Data** tab. 3. Click to select how this index should process archived documents: @@ -277,42 +286,44 @@ This setting will **override** the global configuration defined by the [Indexing * **Include Archived**: Index both archived and non-archived documents. * **Archived Only**: Index only archived documents. -![Processing options](./assets/processing-options.png) - +![Processing options](../assets/processing-options.png) + -## Archived documents and querying + * **Full collection queries**: * Queries that scan an entire collection without any filtering condition (e.g. `from Orders`) will include archived documents. * These queries are not influenced by indexing configuration related to archived documents because they do not use indexes. - * Learn more about full collection queries in [Full collection query](../client-api/session/querying/how-to-query.mdx#collectionQuery). + * Learn more about full collection queries in [Full collection query](../../client-api/session/querying/how-to-query.mdx#collectionQuery). * **Dynamic queries (auto-indexes)**: * When making a dynamic query, RavenDB creates an auto-index to serve it. - Whether that index processes archived documents depends on the value of the [Indexing.Auto.ArchivedDataProcessingBehavior](../server/configuration/indexing-configuration.mdx#indexingautoarchiveddataprocessingbehavior) configuration key at the time the query is made. + Whether that index processes archived documents depends on the value of the [Indexing.Auto.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#indexingautoarchiveddataprocessingbehavior) configuration key at the time the query is made. * Once created, the auto-index retains that behavior. Query results will continue to reflect the configuration that was in effect when the index was first built - even if the setting is changed later. - * Learn more about dynamic queries in [Query a collection - with filtering](../client-api/session/querying/how-to-query.mdx#dynamicQuery). + * Learn more about dynamic queries in [Query a collection - with filtering](../../client-api/session/querying/how-to-query.mdx#dynamicQuery). * **Querying static-indexes**: * When querying a static-index, the results will include, exclude, or consist solely of archived documents depending on how the static-index was configured. The index behavior is determined by: - * the value of the [Indexing.Static.ArchivedDataProcessingBehavior](../server/configuration/indexing-configuration.mdx#indexingstaticarchiveddataprocessingbehavior) configuration key at the time the static-index was created, or - + * the value of the [Indexing.Static.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#indexingstaticarchiveddataprocessingbehavior) configuration key at the time the static-index was created, or - * the explicit setting in the index definition, which overrides the global configuration key. - * The index's archived data processing behavior can be modified after its creation using the Studio or the Client API. + * The index's archived data processing behavior can be modified after its creation using Studio or the Client API. + - -## Archived documents and subscriptions + * Processing large volumes of documents in data subscriptions increases the workload on both the server and subscription workers. -* You can reduce this load by defining the subscription query to exclude archived documents, include only archived documents, or process both archived and non-archived data. - This gives you control over which documents are sent to workers - helping you focus on the most relevant data and reduce unnecessary processing. +* You can reduce this load by defining the subscription query to exclude archived documents, + include only archived documents, or process both archived and non-archived data. + This gives you control over which documents are sent to workers - + helping you focus on the most relevant data and reduce unnecessary processing. * **Configuring the subscription task behavior**: * **At the database level or server-wide**: To control whether queries in data subscription tasks process archived documents, - set the `Subscriptions.ArchivedDataProcessingBehavior` configuration key at either the database level or server-wide + set the [Subscriptions.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#subscriptionsarchiveddataprocessingbehavior) configuration key at either the database level or server-wide (default: `ExcludeArchived`). * **Per task**: You can override this global behavior per data subscription task directly in the task definition, @@ -321,19 +332,22 @@ This setting will **override** the global configuration defined by the [Indexing * `ExcludeArchived`: only non-archived documents are processed by the subscription query. * `IncludeArchived`: both archived and non-archived documents are processed by the subscription query. * `ArchivedOnly`: only archived documents are processed by the subscription query. -##### Configuring archived document processing for a data subscription task - from the Client API - -You can configure how a subscription task handles archived documents when creating the subscription using the Client API. -This setting will **override** the global configuration defined by the [Subscriptions.ArchivedDataProcessingBehavior](../server/configuration/subscription-configuration.mdx#subscriptionsarchiveddataprocessingbehavior) configuration key. - +--- + +### Configuring archived document processing for a data subscription task -
from the Client API +You can configure how a subscription task handles archived documents when creating the subscription using the Client API. +This setting will **override** the global configuration defined by the [Subscriptions.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#subscriptionsarchiveddataprocessingbehavior) configuration key. + + + Example: - -{`var subscriptionName = store.Subscriptions +```csharp +var subscriptionName = store.Subscriptions .Create(new SubscriptionCreationOptions() { Name = "ArchivedOrdersSubscription", @@ -343,12 +357,11 @@ Example: // You can set the behavior to 'ExcludeArchived', 'IncludeArchived, or 'ArchivedOnly' }); -`} - +``` - -{`var subscriptionName = store.Subscriptions +```csharp +var subscriptionName = store.Subscriptions .Create(new SubscriptionCreationOptions() { Name = "ArchivedOrdersSubscription", @@ -359,20 +372,22 @@ Example: // You can set the behavior to 'ExcludeArchived', 'IncludeArchived, or 'ArchivedOnly' }); -`} - +``` -
-##### Configuring archived document processing for a data subscription task - from the Studio + + +--- -You can configure how a subscription task handles archived documents directly from the Studio. -This setting will **override** the global configuration defined by the [Subscriptions.ArchivedDataProcessingBehavior](../server/configuration/subscription-configuration.mdx#subscriptionsarchiveddataprocessingbehavior) configuration key. +### Configuring archived document processing for a data subscription task -
from the Studio -![Configure subscription](./assets/configure-subscription.png) +You can configure how a subscription task handles archived documents directly from the Studio. +This setting will **override** the global configuration defined by the [Subscriptions.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#subscriptionsarchiveddataprocessingbehavior) configuration key. -1. Open the [Ongoing tasks list view](../studio/database/tasks/ongoing-tasks/general-info.mdx) and select the subscription task you want to configure, +![Configure subscription](../assets/configure-subscription.png) + +1. Open the [Ongoing tasks list view](../../studio/database/tasks/ongoing-tasks/general-info.mdx) and select the subscription task you want to configure, or create a new subscription. 2. Click to select how the subscription query should process archived documents: * **Default**: The subscription will use the behavior set by the global configuration. @@ -380,9 +395,9 @@ This setting will **override** the global configuration defined by the [Subscrip * **Include Archived**: Process both archived and non-archived documents. * **Archived Only**: Process only archived documents. +
- -## Archived documents and document extensions + * **Attachments**: * Attachments are Not archived (compressed), even if the document they belong to is archived. @@ -403,35 +418,37 @@ This setting will **override** the global configuration defined by the [Subscrip * No revision is created at the time the server archives a document, even if the Revisions feature is enabled. * However, if you modify an archived document (when Revisions are enabled), a revision is created for that document - and that revision is archived as well. + - -## Archived documents and smuggler (export/import) + You can control whether archived documents are included when exporting or importing a database. -##### Export/Import archived documents - from the Client API -[Smuggler](../client-api/smuggler/what-is-smuggler.mdx), RavenDB’s tool for database export and import, can be configured to include or exclude archived documents. +--- + +### Export/Import archived documents - from the Client API + +[Smuggler](../../client-api/smuggler/what-is-smuggler.mdx), RavenDB’s tool for database export and import, can be configured to include or exclude archived documents. By default, archived documents are **included** in the operation. - + In this example, exported data **excludes** archived documents: - -{`var exportOperation = store.Smuggler.ExportAsync( +```csharp +var exportOperation = store.Smuggler.ExportAsync( new DatabaseSmugglerExportOptions() - \{ + { // Export only non-archived documents: IncludeArchived = false - \}, "DestinationFilePath"); -`} - + }, "DestinationFilePath"); +``` - + - + In this example, imported data **includes** archived documents: @@ -447,25 +464,31 @@ In this example, imported data **includes** archived documents: - -##### Export archived documents - from the Studio + -![Export archived documents](./assets/export-archived-documents.png) +--- + +### Export archived documents - from the Studio + +![Export archived documents](../assets/export-archived-documents.png) 1. Go to **Tasks > Export Database**. 2. Toggle the **Include archived documents** option to control whether archived documents are included in the database export. -##### Import archived documents - from the Studio + +--- + +### Import archived documents - from the Studio -![Import archived documents](./assets/import-archived-documents.png) +![Import archived documents](../assets/import-archived-documents.png) 1. Go to **Tasks > Import Data**. 2. Toggle the **Include archived documents** option to control whether archived documents are included in the import. + + -## Archived documents and expiration - -* Archiving can be used alongside other features, such as [Document expiration](../server/extensions/expiration.mdx). +* Archiving can be used alongside other features, such as [Document expiration](../../server/extensions/expiration.mdx). * For example, a document can be scheduled to be archived after six months and expired after one year. This allows you to keep recent documents active and quickly accessible, move older documents to archival storage where slower access is acceptable, @@ -474,53 +497,51 @@ In this example, imported data **includes** archived documents: * In the following example, both the `@archive-at` and the `@expires` metadata properties have been added to document `companies/90-A` to schedule it for archiving and expiration, respectively: - - -{`\{ + +```json +{ "Name": "Wilman Kala", "Phone": "90-224 8858", ... - "@metadata": \{ + "@metadata": { "@archive-at": "2026-01-06T22:45:30.018Z", "@expires": "2026-07-06T22:45:30.018Z", "@collection": "Companies", ... - \} -\} -`} - + } +} +``` + + -## Archived documents and ETL - -* An ETL transformation script can examine each source document’s [metadata](../server/ongoing-tasks/etl/raven.mdx#accessing-metadata) +* An ETL transformation script can examine each source document’s [metadata](../../server/ongoing-tasks/etl/raven.mdx#accessing-metadata) for the existence of the `@archived: true` property, which indicates that the document is archived. Based on this check, the script can decide how to handle the document - for example, skip it entirely or send only selected fields. -* With [RavenDB ETL](../server/ongoing-tasks/etl/raven), documents that are archived in the source database and sent to the target +* With [RavenDB ETL](../../server/ongoing-tasks/etl/raven), documents that are archived in the source database and sent to the target are not archived in the destination database. * In the following example, the ETL script checks whether the document is archived, and skips it if it is: - - -{`var isArchived = this['@metadata']['@archived']; + +```js +var isArchived = this['@metadata']['@archived']; -if (isArchived === true) \{ +if (isArchived === true) { return; // Do not process archived documents -\} +} // Transfer only non-archived documents to the target loadToOrders(this); -`} - +``` + - -## Archived documents and backup + * Archived documents are included in database backups (both _logical backups_ and _snapshots_), no special configuration is required. @@ -528,29 +549,27 @@ loadToOrders(this); * When restoring a database from a backup, archived documents are restored as well, and their archived status is preserved. + + -## Archived documents and replication - -Archived documents are included in [Internal](../server/clustering/replication/replication-overview.mdx#internal-replication) replication, -[External](../server/clustering/replication/replication-overview.mdx#external-replication) replication, and [Hub/Sink](../server/clustering/replication/replication-overview.mdx#hubsink-replication) replication - +Archived documents are included in [Internal](../../server/clustering/replication/replication-overview.mdx#internal-replication) replication, +[External](../../server/clustering/replication/replication-overview.mdx#external-replication) replication, and [Hub/Sink](../../server/clustering/replication/replication-overview.mdx#hubsink-replication) replication - no special configuration is required. + - -## Archived documents and patching + * Patching can be used to **schedule** multiple documents for archiving. See the dedicated sections: - [Schedule multiple documents for archiving - from the Studio](../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving---from-the-studio). - [Schedule multiple documents for archiving - from the Client API](../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving---from-the-client-api). + [Schedule multiple documents for archiving - from the Studio](../../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving---from-the-studio). + [Schedule multiple documents for archiving - from the Client API](../../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving---from-the-client-api). * Patching is used to **unarchive** documents. - See the dedicated article [Unarchiving documents](../data-archival/unarchiving-documents.mdx). + See the dedicated article [Unarchiving documents](../../data-archival/unarchiving-documents.mdx). * When **cloning** an archived document using the `put` method within a patching script - (see this [clone document example](../client-api/operations/patching/single-document.mdx#clone-document)) the cloned document will Not be archived, + (see this [clone document example](../../client-api/operations/patching/single-document.mdx#clone-document)) the cloned document will Not be archived, and the `@archived: true` property will be removed from the cloned document. - - - + \ No newline at end of file diff --git a/versioned_docs/version-7.1/data-archival/_enable-data-archiving-csharp.mdx b/docs/data-archival/content/_enable-data-archiving-csharp.mdx similarity index 75% rename from versioned_docs/version-7.1/data-archival/_enable-data-archiving-csharp.mdx rename to docs/data-archival/content/_enable-data-archiving-csharp.mdx index 4b2741bca0..7203941dd1 100644 --- a/versioned_docs/version-7.1/data-archival/_enable-data-archiving-csharp.mdx +++ b/docs/data-archival/content/_enable-data-archiving-csharp.mdx @@ -2,6 +2,8 @@ import Admonition from '@theme/Admonition'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ContentFrame from '@site/src/components/ContentFrame'; +import Panel from '@site/src/components/Panel'; @@ -13,22 +15,24 @@ import CodeBlock from '@theme/CodeBlock'; * Once enabled, the archiving task runs periodically at the configured frequency, scanning the database for documents that have been scheduled for archival. - Learn how to schedule documents for archival in [Schedule document archiving](../data-archival/schedule-document-archiving.mdx). + Learn how to schedule documents for archival in [Schedule document archiving](../../data-archival/schedule-document-archiving.mdx). * In this article: - * [Enable archiving - from the Client API](../data-archival/enable-data-archiving.mdx#enable-archiving---from-the-client-api) - * [Enable archiving - from the Studio](../data-archival/enable-data-archiving.mdx#enable-archiving---from-the-studio) + * [Enable archiving - from the Client API](../../data-archival/enable-data-archiving.mdx#enable-archiving-from-the-client-api) + * [Enable archiving - from the Studio](../../data-archival/enable-data-archiving.mdx#enable-archiving-from-the-studio) -## Enable archiving - from the Client API + + Use `ConfigureDataArchivalOperation` to enable archiving for the database and configure the archiving task. + **Example**: - -{`// Define the archival configuration object +```csharp +// Define the archival configuration object var configuration = new DataArchivalConfiguration { // Enable archiving @@ -47,12 +51,11 @@ var configureArchivalOp = new ConfigureDataArchivalOperation(configuration); // Execute the operation by passing it to Maintenance.Send store.Maintenance.Send(configureArchivalOp); -`} - +``` - -{`// Define the archival configuration object +```csharp +// Define the archival configuration object var configuration = new DataArchivalConfiguration { // Enable archiving @@ -71,42 +74,40 @@ var configureArchivalOp = new ConfigureDataArchivalOperation(configuration); // Execute the operation by passing it to Maintenance.SendAsync await store.Maintenance.SendAsync(configureArchivalOp); -`} - +``` + **Syntax**: - - -{`public ConfigureDataArchivalOperation(DataArchivalConfiguration configuration) -`} - + +```csharp +public ConfigureDataArchivalOperation(DataArchivalConfiguration configuration) +``` - - -{`public class DataArchivalConfiguration -\{ - public bool Disabled \{ get; set; \} - public long? ArchiveFrequencyInSec \{ get; set; \} - public long? MaxItemsToProcess \{ get; set; \} -\} -`} - + +```csharp +public class DataArchivalConfiguration +{ + public bool Disabled { get; set; } + public long? ArchiveFrequencyInSec { get; set; } + public long? MaxItemsToProcess { get; set; } +} +``` | Parameter | Type | Description | |---------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **Disabled** | `bool` | `true` - archiving is disabled for the entire database (default).
`false` - archiving is enabled for the database. | +| **Disabled** | `bool` | `true` - archiving is disabled for the entire database (default).
`false` - archiving is enabled for the database. | | **ArchiveFrequencyInSec** | `long?` | Frequency (in seconds) at which the server scans for documents scheduled for archiving. Default: `60` | -| **MaxItemsToProcess** | `long?` | The maximum number of documents the archiving task will process in a single run (i.e., each time it is triggered by the configured frequency). Default: `int.MaxValue` | - +| **MaxItemsToProcess** | `long?` | The maximum number of documents the archiving task will process in a single run (i.e., each time it is triggered by the configured frequency).
Default: `int.MaxValue` | +
-## Enable archiving - from the Studio + -![Enable archiving](./assets/enable-archiving.png) +![Enable archiving](../assets/enable-archiving.png) 1. Go to **Settings > Data Archival**. 2. Toggle on to enable data archival. @@ -114,7 +115,5 @@ await store.Maintenance.SendAsync(configureArchivalOp); Default is 60 seconds. 4. Toggle on to customize the maximum number of documents the archiving task will process in a single run. 5. Click Save to apply your settings. - - - - + + \ No newline at end of file diff --git a/versioned_docs/version-7.1/data-archival/_schedule-document-archiving-csharp.mdx b/docs/data-archival/content/_schedule-document-archiving-csharp.mdx similarity index 78% rename from versioned_docs/version-7.1/data-archival/_schedule-document-archiving-csharp.mdx rename to docs/data-archival/content/_schedule-document-archiving-csharp.mdx index cd81710280..185d27a642 100644 --- a/versioned_docs/version-7.1/data-archival/_schedule-document-archiving-csharp.mdx +++ b/docs/data-archival/content/_schedule-document-archiving-csharp.mdx @@ -2,40 +2,44 @@ import Admonition from '@theme/Admonition'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ContentFrame from '@site/src/components/ContentFrame'; +import Panel from '@site/src/components/Panel'; * Documents cannot be archived directly - they must be scheduled for archival. - To **schedule a document** for archival, add the `@archive-at` property to the document's metadata and set its value to the desired archival time (in UTC). + To **schedule a document** for archival, add the `@archive-at` property to the document's metadata and set its value to the desired archival time (in UTC). This can be done in several ways, as described in this article. * **Note**: Just scheduling a document for archival does Not archive it at the specified time. - Actual archiving is performed only by a background task that runs when the archival feature is [enabled](../data-archival/enable-data-archiving.mdx). + Actual archiving is performed only by a background task that runs when the archival feature is [enabled](../../data-archival/enable-data-archiving.mdx). This task periodically scans the database for documents scheduled for archival. - The scan frequency is configurable when [enabling ](../data-archival/enable-data-archiving.mdx) the archival feature (default: 60 seconds). + The scan frequency is configurable when [enabling ](../../data-archival/enable-data-archiving.mdx) the archival feature (default: 60 seconds). * The archiving task will archive any document whose `@archive-at` time has passed at the time of the scan. The `@archive-at` metadata property will then be replaced with `@archived: true`. * You can schedule documents for archival even if the archiving feature is not yet enabled. These documents will be archived once the feature is enabled and the task runs - provided the scheduled time has already passed. + * In this article: - * [Schedule a SINGLE document for archiving - from the Client API](../data-archival/schedule-document-archiving.mdx#schedule-a-single-document-for-archiving---from-the-client-api) - * [Schedule a SINGLE document for archiving - from the Studio](../data-archival/schedule-document-archiving.mdx#schedule-a-single-document-for-archiving---from-the-studio) - * [Schedule MULTIPLE documents for archiving - from the Client API](../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving---from-the-client-api) - * [Schedule MULTIPLE documents for archiving - from the Studio](../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving---from-the-studio) + * [Schedule a SINGLE document for archiving - from the Client API](../../data-archival/schedule-document-archiving.mdx#schedule-a-single-document-for-archiving-from-the-client-api) + * [Schedule a SINGLE document for archiving - from the Studio](../../data-archival/schedule-document-archiving.mdx#schedule-a-single-document-for-archiving-from-the-studio) + * [Schedule MULTIPLE documents for archiving - from the Client API](../../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving-from-the-client-api) + * [Schedule MULTIPLE documents for archiving - from the Studio](../../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving-from-the-studio) -## Schedule a SINGLE document for archiving - from the Client API + + To schedule a single document for archival from the Client API, add the `@archive-at` property directly to the document metadata as follows: - -{`using (var session = store.OpenSession()) +```csharp +using (var session = store.OpenSession()) { // Load the document to schedule for archiving var company = session.Load("companies/91-A"); @@ -50,12 +54,11 @@ add the `@archive-at` property directly to the document metadata as follows: // Save the changes session.SaveChanges(); } -`} - +``` - -{`using (var asyncSession = store.OpenAsyncSession()) +```csharp +using (var asyncSession = store.OpenAsyncSession()) { // Load the document to schedule for archiving var company = await asyncSession.LoadAsync("companies/91-A"); @@ -70,16 +73,15 @@ add the `@archive-at` property directly to the document metadata as follows: // Save the changes await asyncSession.SaveChangesAsync(); } -`} - +``` -Learn more about modifying the metadata of a document in [Modifying Document Metadata](../client-api/session/how-to/get-and-modify-entity-metadata.mdx). - +Learn more about modifying the metadata of a document in [Modifying Document Metadata](../../client-api/session/how-to/get-and-modify-entity-metadata.mdx). + -## Schedule a SINGLE document for archiving - from the Studio + * To schedule a single document for archival from the Studio: * Open the Document view. @@ -87,15 +89,15 @@ Learn more about modifying the metadata of a document in [Modifying Document Met * Set its value to the desired archive time in UTC format. * Save the document. -![Schedule a document for archiving](./assets/schedule-document-for-archiving.png) +![Schedule a document for archiving](../assets/schedule-document-for-archiving.png) 1. This is the `@archive-at` property that was added to the document's metadata. E.g.: `"@archive-at": "2025-06-25T14:00:00.0000000Z"` 2. After saving the document, the Studio displays the time remaining until the document is archived. + - -## Schedule MULTIPLE documents for archiving - from the Client API + * Use the `PatchByQueryOperation` to schedule multiple documents for archiving. @@ -104,6 +106,7 @@ Learn more about modifying the metadata of a document in [Modifying Document Met * When the patch operation is executed, the server will add the `@archive-at` property to the metadata of all documents that match the query filter. + **Example:** The following example schedules all orders that were made at least a year ago for archival. @@ -112,8 +115,8 @@ Any document matching the query is then scheduled for archival by the **patch sc - -{`var archiveDate = SystemTime.UtcNow.AddDays(1); +```csharp +var archiveDate = SystemTime.UtcNow.AddDays(1); string archiveDateString = archiveDate.ToString("o"); var oldDate = SystemTime.UtcNow.AddYears(-1); @@ -137,12 +140,11 @@ var patchByQueryOp = new PatchByQueryOperation(patchByQuery); // Execute the operation by passing it to Operations.Send store.Operations.Send(patchByQueryOp); -`} - +``` - -{`var archiveDate = SystemTime.UtcNow.AddDays(1); +```csharp +var archiveDate = SystemTime.UtcNow.AddDays(1); string archiveDateString = archiveDate.ToString("o"); var oldDate = SystemTime.UtcNow.AddYears(-1); @@ -162,12 +164,11 @@ var patchByQueryOp = new PatchByQueryOperation(patchByQuery); // Execute the operation by passing it to Operations.SendAsync await store.Operations.SendAsync(patchByQueryOp); -`} - +``` - -{`var archiveDate = SystemTime.UtcNow.AddDays(1); +```csharp +var archiveDate = SystemTime.UtcNow.AddDays(1); string archiveDateString = archiveDate.ToString("o"); var oldDate = SystemTime.UtcNow.AddYears(-1); @@ -195,12 +196,11 @@ var patchByQueryOp = new PatchByQueryOperation(new IndexQuery() // Execute the operation by passing it to Operations.Send store.Operations.Send(patchByQueryOp); -`} - +``` - -{`var archiveDate = SystemTime.UtcNow.AddDays(1); +```csharp +var archiveDate = SystemTime.UtcNow.AddDays(1); string archiveDateString = archiveDate.ToString("o"); var oldDate = SystemTime.UtcNow.AddYears(-1); @@ -228,17 +228,16 @@ var patchByQueryOp = new PatchByQueryOperation(new IndexQuery() // Execute the operation by passing it to Operations.SendAsync await store.Operations.SendAsync(patchByQueryOp); -`} - +``` + **Syntax:** - - -{`archived.archiveAt(doc, utcDateTimeString) -`} - + +```csharp +archived.archiveAt(doc, utcDateTimeString) +``` | Parameter | Type | Description | @@ -246,29 +245,28 @@ await store.Operations.SendAsync(patchByQueryOp); | **doc** | `object` | The document to schedule for archiving. | | **utcDateTimeString** | `string` | The UTC timestamp (as a string) that specifies when the document should be archived. | -To learn more about the `PatchByQueryOperation`, see [Set-based patch operations](../client-api/operations/patching/set-based.mdx). +To learn more about the `PatchByQueryOperation`, see [Set-based patch operations](../../client-api/operations/patching/set-based.mdx). + - -## Schedule MULTIPLE documents for archiving - from the Studio + * To schedule multiple documents for archiving from the Studio: * Open the Patch view. * Enter a patch script that uses the `archived.archiveAt` method, providing the desired archive date in UTC. * Execute the patch. + **Example**: The following patch script, used directly in the Studio, -performs the same operation as the [Client API example](../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving---from-the-client-api) shown above. +performs the same operation as the [Client API example](../../data-archival/schedule-document-archiving.mdx#schedule-multiple-documents-for-archiving-from-the-client-api) shown above. -![Schedule multiple documents for archiving](./assets/schedule-multiple-documents-for-archiving.png) +![Schedule multiple documents for archiving](../assets/schedule-multiple-documents-for-archiving.png) 1. Open the Patch view. 2. Enter the patch script. 3. Click to execute the patch. 4. You can test the patch on a sample document before executing the whole operation. - Learn more in [Test patch](../studio/database/documents/patch-view.mdx#test-patch). - - - + Learn more in [Test patch](../../studio/database/documents/patch-view.mdx#test-patch). + \ No newline at end of file diff --git a/versioned_docs/version-7.1/data-archival/_unarchiving-documents-csharp.mdx b/docs/data-archival/content/_unarchiving-documents-csharp.mdx similarity index 61% rename from versioned_docs/version-7.1/data-archival/_unarchiving-documents-csharp.mdx rename to docs/data-archival/content/_unarchiving-documents-csharp.mdx index 1f12e49710..63bb7535ae 100644 --- a/versioned_docs/version-7.1/data-archival/_unarchiving-documents-csharp.mdx +++ b/docs/data-archival/content/_unarchiving-documents-csharp.mdx @@ -2,6 +2,8 @@ import Admonition from '@theme/Admonition'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ContentFrame from '@site/src/components/ContentFrame'; +import Panel from '@site/src/components/Panel'; @@ -15,12 +17,13 @@ import CodeBlock from '@theme/CodeBlock'; To properly unarchive a document, use the `archived.unarchive()` method as described below. * In this article: - * [Unarchive documents - from the Client API](../data-archival/unarchiving-documents.mdx#unarchive-documents---from-the-client-api) - * [Unarchive documents - from the Studio](../data-archival/unarchiving-documents.mdx#unarchive-documents---from-the-studio) - * [Unarchiving documents with index-based patch queries](../data-archival/unarchiving-documents.mdx#unarchiving-documents-with-index-based-patch-queries) + * [Unarchive documents - from the Client API](../../data-archival/unarchiving-documents.mdx#unarchive-documents-from-the-client-api) + * [Unarchive documents - from the Studio](../../data-archival/unarchiving-documents.mdx#unarchive-documents-from-the-studio) + * [Unarchiving documents with index-based patch queries](../../data-archival/unarchiving-documents.mdx#unarchiving-documents-with-index-based-patch-queries) -## Unarchive documents - from the Client API + + * To unarchive documents from the Client API, use the `PatchByQueryOperation` operation, which targets one or more documents based on the patch query. @@ -29,14 +32,15 @@ import CodeBlock from '@theme/CodeBlock'; * Within the **patch script**, call the `archived.unarchive()` method to unarchive all documents that match the **patch query**. + **Example:** The following operation will unarchive ALL archived documents in the _Orders_ collection. - -{`// Define the patch query string +```csharp +// Define the patch query string string patchByQuery = @" // The patch query: // ================ @@ -53,12 +57,11 @@ var patchByQueryOp = new PatchByQueryOperation(patchByQuery); // Execute the operation by passing it to Operations.Send store.Operations.Send(patchByQueryOp); -`} - +``` - -{`// Define the patch query string +```csharp +// Define the patch query string string patchByQuery = @" from Orders update @@ -71,12 +74,11 @@ var patchByQueryOp = new PatchByQueryOperation(patchByQuery); // Execute the operation by passing it to Operations.Send await store.Operations.SendAsync(patchByQueryOp); -`} - +``` - -{`// Define the patch query string +```csharp +// Define the patch query string string patchByQuery = @" from Orders update @@ -92,12 +94,11 @@ var patchByQueryOp = new PatchByQueryOperation(new IndexQuery() // Execute the operation by passing it to Operations.Send store.Operations.Send(patchByQueryOp); -`} - +``` - -{`// Define the patch query string +```csharp +// Define the patch query string string patchByQuery = @" from Orders update @@ -113,48 +114,48 @@ var patchByQueryOp = new PatchByQueryOperation(new IndexQuery() // Execute the operation by passing it to Operations.Send await store.Operations.SendAsync(patchByQueryOp); -`} - +``` + **Syntax:** - - -{`archived.unarchive(doc) -`} - + +```csharp +archived.unarchive(doc) +``` | Parameter | Type | Description | |------------|----------|----------------------------| | **doc** | `object` | The document to unarchive. | + - -## Unarchive documents - from the Studio + * To unarchive documents from the Studio: * Open the Patch view. * Enter a patch script that uses the `archived.unarchive()` method. * Execute the patch. + **Example**: The following patch script, used directly in the Studio, -performs the same operation as the [Client API example](../data-archival/unarchiving-documents.mdx#unarchive-documents---from-the-client-api) shown above. +performs the same operation as the [Client API example](../../data-archival/unarchiving-documents.mdx#unarchive-documents-from-the-client-api) shown above. It will unarchive all archived documents in the _Orders_ collection. -![Unarchive documents](./assets/unarchive-documents.png) +![Unarchive documents](../assets/unarchive-documents.png) 1. Open the Patch view. 2. Enter the patch script. 3. Click to execute the patch. 4. You can test the patch on a sample document before executing the whole operation. - Learn more in [Test patch](../studio/database/documents/patch-view.mdx#test-patch). - + Learn more in [Test patch](../../studio/database/documents/patch-view.mdx#test-patch). + -## Unarchiving documents with index-based patch queries + * When running a patch query to unarchive documents over an index, you need to consider the index configuration regarding archived documents. @@ -164,27 +165,27 @@ It will unarchive all archived documents in the _Orders_ collection. As a result, no documents will be unarchived by the patch operation. * For example, the following patch query uses a dynamic query that creates an auto-index. - If the [Indexing.Auto.ArchivedDataProcessingBehavior](../server/configuration/indexing-configuration.mdx#indexingautoarchiveddataprocessingbehavior) configuration key is set to its default `ExcludeArchived` value, - then even if archived documents exist in the _Orders_ collection with `ShipTo.Country == 'USA'`, they will not be matched - because the auto-index does not include them - - and the patch operation will not unarchive any documents. - - - -{`string patchByQuery = @" - // This filtering query creates an auto-index: - // =========================================== - from Orders - where ShipTo.Country == 'USA' - update - \{ - archived.unarchive(this) - \}"; - -var patchByQueryOp = new PatchByQueryOperation(patchByQuery); -store.Operations.Send(patchByQueryOp); -`} - - + If the [Indexing.Auto.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#indexingautoarchiveddataprocessingbehavior) configuration key is set to its default `ExcludeArchived` value, + then even if archived documents exist in the _Orders_ collection with `ShipTo.Country == 'USA'`, + they will Not be matched because the auto-index does not include them and the patch operation will not unarchive any documents. + + + ```csharp + string patchByQuery = @" + // This filtering query creates an auto-index: + // =========================================== + from Orders + where ShipTo.Country == 'USA' + update + { + archived.unarchive(this) + }"; + + var patchByQueryOp = new PatchByQueryOperation(patchByQuery); + store.Operations.Send(patchByQueryOp); + ``` + + Two possible workarounds are: 1. **Configure the index to include archived documents**: @@ -192,39 +193,36 @@ Two possible workarounds are: Use this option only if including archived documents in the index aligns with your indexing strategy. **For auto-indexes**: - Set the [Indexing.Auto.ArchivedDataProcessingBehavior](../server/configuration/indexing-configuration.mdx#indexingautoarchiveddataprocessingbehavior) configuration key to `IncludeArchived`. + Set the [Indexing.Auto.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#indexingautoarchiveddataprocessingbehavior) configuration key to `IncludeArchived`. **For static-indexes**: - Set the [Indexing.Static.ArchivedDataProcessingBehavior](../server/configuration/indexing-configuration.mdx#indexingstaticarchiveddataprocessingbehavior) configuration key to `IncludeArchived`, + Set the [Indexing.Static.ArchivedDataProcessingBehavior](../../data-archival/configuration.mdx#indexingstaticarchiveddataprocessingbehavior) configuration key to `IncludeArchived`, or - configure the definition of the specific static-index to include archived documents. - See [Archived documents and indexing](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-indexing). + See [Archived documents and indexing](../../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-indexing). 2. **Use a collection query instead of an index query**: Run a simple collection-based query that does not rely on an index. Apply your filtering logic inside the patch script to unarchive only the relevant documents. For example: - - -{`string patchByQuery = @" - // Perform a collection query: - // =========================== - from Orders as order - update - \{ - // Filter documents inside the script: - // =================================== - if (order.ShipTo.City == 'New York') - \{ - archived.unarchive(this) - \} - \}"; - -var patchByQueryOp = new PatchByQueryOperation(patchByQuery); -store.Operations.Send(patchByQueryOp); -`} - - - - - - + + ```csharp + string patchByQuery = @" + // Perform a collection query: + // =========================== + from Orders as order + update + { + // Filter documents inside the script: + // =================================== + if (order.ShipTo.City == 'New York') + { + archived.unarchive(this) + } + }"; + + var patchByQueryOp = new PatchByQueryOperation(patchByQuery); + store.Operations.Send(patchByQueryOp); + ``` + + + \ No newline at end of file diff --git a/docs/data-archival/enable-data-archiving.mdx b/docs/data-archival/enable-data-archiving.mdx index 5792991f3d..16230c270a 100644 --- a/docs/data-archival/enable-data-archiving.mdx +++ b/docs/data-archival/enable-data-archiving.mdx @@ -1,15 +1,14 @@ --- title: "Enable Data Archiving" -sidebar_label: Enable Data Archiving -sidebar_position: 1 +sidebar_label: "Enable Data Archiving" +sidebar_position: 2 supported_languages: ["csharp"] --- import LanguageSwitcher from "@site/src/components/LanguageSwitcher"; import LanguageContent from "@site/src/components/LanguageContent"; -import EnableDataArchivingCsharp from './_enable-data-archiving-csharp.mdx'; - +import EnableDataArchivingCsharp from './content/_enable-data-archiving-csharp.mdx'; @@ -17,7 +16,6 @@ import EnableDataArchivingCsharp from './_enable-data-archiving-csharp.mdx'; - +--> \ No newline at end of file diff --git a/docs/data-archival/overview.mdx b/docs/data-archival/overview.mdx index 185720765b..c2b2b97495 100644 --- a/docs/data-archival/overview.mdx +++ b/docs/data-archival/overview.mdx @@ -1,7 +1,7 @@ --- title: "Data Archival Overview" sidebar_label: Overview -sidebar_position: 0 +sidebar_position: 1 --- import Admonition from '@theme/Admonition'; @@ -10,6 +10,8 @@ import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; import LanguageSwitcher from "@site/src/components/LanguageSwitcher"; import LanguageContent from "@site/src/components/LanguageContent"; +import ContentFrame from '@site/src/components/ContentFrame'; +import Panel from '@site/src/components/Panel'; # Data Archival Overview @@ -29,13 +31,15 @@ import LanguageContent from "@site/src/components/LanguageContent"; * To take advantage of the archiving feature, you must first **enable** it. Once enabled, you can **schedule** documents for archiving. Learn more in the [Overview](../data-archival/overview.mdx#overview) section below. + * In this article: * [Overview](../data-archival/overview.mdx#overview) * [The archived document](../data-archival/overview.mdx#the-archived-document) * [Licensing](../data-archival/overview.mdx#licensing) -## Overview + + * **Enable the archiving feature** * To archive documents, you must first enable the archiving feature in RavenDB. @@ -56,7 +60,7 @@ import LanguageContent from "@site/src/components/LanguageContent"; A revision that is created from an archived document is archived as well. * **Modifying archived documents** - * Archived documents and their extensions (time series, counters, attachments) remain accessible and can be updated + * Archived documents and their extensions (time series, counters, attachments) remain accessible and can be updated (except for revisions, which are immutable). * Modifying an archived document or any of its extensions does not affect its archival status - the document remains archived. @@ -65,26 +69,29 @@ import LanguageContent from "@site/src/components/LanguageContent"; * An archived document can be unarchived. Learn more in the dedicated article: [Unarchiving documents](../data-archival/unarchiving-documents.mdx). + - -## The archived document + A document that has been archived is compressed and marked with both a metadata property and an internal metadata flag: * **Metadata property**: * When a document is archived, the archiving task replaces the `@archive-at` metadata property with `"@archived": true`. - * This property is informational only - you **cannot** archive a document by manually adding `"@archived": true` to its metadata. - To archive a document, you must schedule it for archival. Learn more in [Schedule document archiving](../data-archival/schedule-document-archiving.mdx). + * This property is informational only - + you **cannot** archive a document by manually adding `"@archived": true` to its metadata. + To archive a document, you must schedule it for archival. + Learn more in [Schedule document archiving](../data-archival/schedule-document-archiving.mdx). * This property allows RavenDB features, clients, and users to recognize the document’s archived status and handle it accordingly. - For example, a user-defined ETL task can use the presence of this property to skip or handle archived documents differently. + For example, a user-defined ETL task can use the presence of this property to skip or handle archived documents differently. Learn more in [Archived documents and other features](../data-archival/archived-documents-and-other-features.mdx). * **Internal flag**: * When a document is archived, the internal flag `"@flags": "Archived"` is added to its metadata. - * Features like indexing and data subscriptions use this flag to detect archived documents and handle them based on the configured behavior. + * Features like indexing and data subscriptions use this flag to detect archived documents and handle them based on the configured behavior. Learn more in [Archived documents and indexing](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-indexing) & [Archived documents and data subscriptions](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-subscriptions). + **An archived document**: ![An archived document](./assets/an-archived-document.png) @@ -98,12 +105,11 @@ A document that has been archived is compressed and marked with both a metadata 1. This icon indicates the document is archived. + - -## Licensing + The archival feature is available with the **Enterprise** license. Learn more about licensing in [Licensing overview](../start/licensing/licensing-overview.mdx). - - + \ No newline at end of file diff --git a/docs/data-archival/schedule-document-archiving.mdx b/docs/data-archival/schedule-document-archiving.mdx index c22e6a21ed..d240c28e20 100644 --- a/docs/data-archival/schedule-document-archiving.mdx +++ b/docs/data-archival/schedule-document-archiving.mdx @@ -1,15 +1,14 @@ --- title: "Schedule Document Archiving" -sidebar_label: Schedule Document Archiving -sidebar_position: 2 +sidebar_label: "Schedule Document Archiving" +sidebar_position: 3 supported_languages: ["csharp"] --- import LanguageSwitcher from "@site/src/components/LanguageSwitcher"; import LanguageContent from "@site/src/components/LanguageContent"; -import ScheduleDocumentArchivingCsharp from './_schedule-document-archiving-csharp.mdx'; - +import ScheduleDocumentArchivingCsharp from './content/_schedule-document-archiving-csharp.mdx'; @@ -17,7 +16,6 @@ import ScheduleDocumentArchivingCsharp from './_schedule-document-archiving-csha - +--> \ No newline at end of file diff --git a/versioned_docs/version-7.1/data-archival/overview.mdx b/versioned_docs/version-7.1/data-archival/overview.mdx index 185720765b..c2b2b97495 100644 --- a/versioned_docs/version-7.1/data-archival/overview.mdx +++ b/versioned_docs/version-7.1/data-archival/overview.mdx @@ -1,7 +1,7 @@ --- title: "Data Archival Overview" sidebar_label: Overview -sidebar_position: 0 +sidebar_position: 1 --- import Admonition from '@theme/Admonition'; @@ -10,6 +10,8 @@ import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; import LanguageSwitcher from "@site/src/components/LanguageSwitcher"; import LanguageContent from "@site/src/components/LanguageContent"; +import ContentFrame from '@site/src/components/ContentFrame'; +import Panel from '@site/src/components/Panel'; # Data Archival Overview @@ -29,13 +31,15 @@ import LanguageContent from "@site/src/components/LanguageContent"; * To take advantage of the archiving feature, you must first **enable** it. Once enabled, you can **schedule** documents for archiving. Learn more in the [Overview](../data-archival/overview.mdx#overview) section below. + * In this article: * [Overview](../data-archival/overview.mdx#overview) * [The archived document](../data-archival/overview.mdx#the-archived-document) * [Licensing](../data-archival/overview.mdx#licensing) -## Overview + + * **Enable the archiving feature** * To archive documents, you must first enable the archiving feature in RavenDB. @@ -56,7 +60,7 @@ import LanguageContent from "@site/src/components/LanguageContent"; A revision that is created from an archived document is archived as well. * **Modifying archived documents** - * Archived documents and their extensions (time series, counters, attachments) remain accessible and can be updated + * Archived documents and their extensions (time series, counters, attachments) remain accessible and can be updated (except for revisions, which are immutable). * Modifying an archived document or any of its extensions does not affect its archival status - the document remains archived. @@ -65,26 +69,29 @@ import LanguageContent from "@site/src/components/LanguageContent"; * An archived document can be unarchived. Learn more in the dedicated article: [Unarchiving documents](../data-archival/unarchiving-documents.mdx). + - -## The archived document + A document that has been archived is compressed and marked with both a metadata property and an internal metadata flag: * **Metadata property**: * When a document is archived, the archiving task replaces the `@archive-at` metadata property with `"@archived": true`. - * This property is informational only - you **cannot** archive a document by manually adding `"@archived": true` to its metadata. - To archive a document, you must schedule it for archival. Learn more in [Schedule document archiving](../data-archival/schedule-document-archiving.mdx). + * This property is informational only - + you **cannot** archive a document by manually adding `"@archived": true` to its metadata. + To archive a document, you must schedule it for archival. + Learn more in [Schedule document archiving](../data-archival/schedule-document-archiving.mdx). * This property allows RavenDB features, clients, and users to recognize the document’s archived status and handle it accordingly. - For example, a user-defined ETL task can use the presence of this property to skip or handle archived documents differently. + For example, a user-defined ETL task can use the presence of this property to skip or handle archived documents differently. Learn more in [Archived documents and other features](../data-archival/archived-documents-and-other-features.mdx). * **Internal flag**: * When a document is archived, the internal flag `"@flags": "Archived"` is added to its metadata. - * Features like indexing and data subscriptions use this flag to detect archived documents and handle them based on the configured behavior. + * Features like indexing and data subscriptions use this flag to detect archived documents and handle them based on the configured behavior. Learn more in [Archived documents and indexing](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-indexing) & [Archived documents and data subscriptions](../data-archival/archived-documents-and-other-features.mdx#archived-documents-and-subscriptions). + **An archived document**: ![An archived document](./assets/an-archived-document.png) @@ -98,12 +105,11 @@ A document that has been archived is compressed and marked with both a metadata 1. This icon indicates the document is archived. + - -## Licensing + The archival feature is available with the **Enterprise** license. Learn more about licensing in [Licensing overview](../start/licensing/licensing-overview.mdx). - - + \ No newline at end of file diff --git a/versioned_docs/version-7.1/data-archival/schedule-document-archiving.mdx b/versioned_docs/version-7.1/data-archival/schedule-document-archiving.mdx index c22e6a21ed..d240c28e20 100644 --- a/versioned_docs/version-7.1/data-archival/schedule-document-archiving.mdx +++ b/versioned_docs/version-7.1/data-archival/schedule-document-archiving.mdx @@ -1,15 +1,14 @@ --- title: "Schedule Document Archiving" -sidebar_label: Schedule Document Archiving -sidebar_position: 2 +sidebar_label: "Schedule Document Archiving" +sidebar_position: 3 supported_languages: ["csharp"] --- import LanguageSwitcher from "@site/src/components/LanguageSwitcher"; import LanguageContent from "@site/src/components/LanguageContent"; -import ScheduleDocumentArchivingCsharp from './_schedule-document-archiving-csharp.mdx'; - +import ScheduleDocumentArchivingCsharp from './content/_schedule-document-archiving-csharp.mdx'; @@ -17,7 +16,6 @@ import ScheduleDocumentArchivingCsharp from './_schedule-document-archiving-csha -