Time Series and Other Features


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

  • Features that are not listed here either have no special behavior in regard to time series, or they have their own pages describing how they interact 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 chosen database items to an external file or to 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 object.

OperateOnTypes = DatabaseItemType.Documents
                 | DatabaseItemType.TimeSeries

Ongoing Tasks

"Ongoing tasks" are various automatic processes that operate on an entire database. Some of these apply to time series data and some 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.

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 saved manually or by setting a policy for a collection that creates them automatically.

Revisions do not preserve time series data, and editing a time series does not trigger the creation of a new revision the way editing a document would. This is because time series are designed so for new entries to be added quickly and often, and creating revisions each time would significantly slow this process down.

However, revisions can be 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

While revisions don't contain the time series data themselves, they do contain few details about the time series the document had at the time. These details appear as though they are part of the document's metadata, but it's not really part of the document. When a revision is viewed in the studio, this "time series snapshot" looks like this:

NoSQL Database Time Series Feature

NoSQL Database Time Series Feature

This time series snapshot 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>": { ... }
    }