Time Series and Other Features


  • This page describes how time series interact with various other RavenDB features.

  • Features not listed here either have no special behavior regarding time series,
    or they have their own pages describing their interaction with time series (such as indexing).

  • In this page:


General features

  • The Document Session tracks changes to time series data.
  • The Changes API service is triggered by changes to time series data.
  • Learn about how to index time series here.
  • Learn about how to query time series data here.
  • Learn how to include time series with session.Load() and in queries here.

Smuggler

Smuggler is a DocumentStore property that can be used to export selected database items to an external file or import database items from an existing file into the database.

To configure smuggler to handle time series, add the parameter DatabaseItemType.TimeSeries to the OperateOnTypes enum property:

OperateOnTypes = DatabaseItemType.Documents | DatabaseItemType.TimeSeries

Ongoing tasks

Ongoing tasks are various automatic processes that operate on the database.
Some of these apply to time series data, while others do not.

Tasks that apply to time series

  • External replication creates a complete copy of a database, including documents and their extensions.
  • Hub/Sink replication allows you to create a live replica of a database or a part of it,
    including documents' time series, using Hub and Sink tasks.
  • Backups save the whole database at a certain point in time and can be used to restore the database later.
    All kinds of backups include time series data: logical-backup and snapshot, full and incremental.
  • RavenDB ETL is a type of task that extracts some portion of the data from a database, transforms it according to a script,
    and loads it to another RavenDB database on another server.

Tasks that cannot be applied to time series

  • SQL ETL, another type of ETL that can set a relational database as its target.
  • Data Subscriptions send data to "worker" clients in batches.

Support for time series in ETL is planned for one of the next releases.

Revisions

Revisions are old versions of a document.
They can be created manually or by setting a policy that creates them automatically on selected collections.

Revisions do not preserve time series data, and editing a time series does not trigger the creation of a new revision as editing a document would. This is because time series are designed to accommodate frequent additions of new entries quickly, and creating revisions each time would significantly slow down this process.

However, revisions are triggered / created manually if a new time series is added to the document,
or an existing time series is deleted. (Remember that a time series is deleted by deleting all of its entries).

The @timeseries-snapshot metadata property

While revisions don't contain the time series data themselves, they do include few details about the time series the document had at the time. These details appear in the @timeseries-snapshot property within the document's metadata. When a revision is viewed in the studio, this metadata property looks like this:

NoSQL Database Time Series Feature

NoSQL Database Time Series Feature

This time series snapshot property can also be accessed by loading a revision in the client.
This is the general JSON format of the time series snapshot:

"@metadata": {
    ...
    "@timeseries-snapshot": {
        "<the name of a time series>": {
            "Count": <the number of entries>,
            "Start": "<timestamp of first entry>",
            "End": "<timestamp of last entry>"
        },
        "<the name of the next time series>": { ... }
    }