---
title: "Get Time Series Entries"
url: "https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/session/get/get-entries"
version: "6.2"
language: "csharp"
---

# Get Time Series Entries

> Client language: C#. Also available for [Python](https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/session/get/get-entries.python.md), [PHP](https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/session/get/get-entries.php.md), [Node.js](https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/session/get/get-entries.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

> **Note**
>
> - Use `TimeSeriesFor.Get` to retrieve a range of entries from a **single** time series.  
>   To retrieve a range of entries from **multiple** series,
>   use the [GetMultipleTimeSeriesOperation](https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/operations/get.md#getmultipletimeseriesoperation) operation.
>
> - The retrieved data can be paged to get the time series entries gradually, one custom-size page at a time.
>
> - By default, the session will track the retrieved time series data.
>   See [disable tracking](https://docs.ravendb.net/6.2/client-api/session/configuration/how-to-disable-tracking.md) to learn how to disable.
>
> - When getting the time series entries,  
>   you can also *include* the series' **parent document** and/or **documents referred to by the entry tag**.  
>   Learn more [below](#include-parent-and-tagged-documents).
>
> - Calling `TimeSeriesFor.Get` will result in a trip to the server unless the series' parent document was loaded  
>   (or queried for) with the time series included beforehand.  
>   Learn more in: [Including time series](https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/session/include/overview.md).
>
> - In this page:
>   - [`Get` usage](#get-usage)
>   - [Examples](#examples)
>     - [Get all entries](#get-all-entries)
>     - [Get range of entries](#get-range-of-entries)
>     - [Get entries with multiple values](#get-entries-with-multiple-values)
>   - [Include parent and tagged documents](#include-parent-and-tagged-documents)
>   - [Syntax](#syntax)

## `Get` usage

- Open a session.
- Create an instance of `TimeSeriesFor` and pass it the following:
  - Provide an explicit document ID, -or-  
    pass an [entity tracked by the session](https://docs.ravendb.net/6.2/client-api/session/what-is-a-session-and-how-does-it-work.md#unit-of-work-pattern),
    e.g. a document object returned from [session.Query](https://docs.ravendb.net/6.2/client-api/session/querying/how-to-query.md) or from [session.Load](https://docs.ravendb.net/6.2/client-api/session/loading-entities.md#load).
  - Specify the time series name.
- Call `TimeSeriesFor.Get`.

## Examples

#### Get all entries:

In this example, we retrieve all entries of the "Heartrate" time series.  
The ID of the parent document is explicitly specified.

```csharp
// Get all time series entries
TimeSeriesEntry[] val = session.TimeSeriesFor("users/john", "HeartRates")
  .Get(DateTime.MinValue, DateTime.MaxValue);
```

#### Get range of entries:

In this example, we query for a document and get its "Heartrate" time series data.

```csharp
// Query for a document with the Name property "John" 
// and get its HeartRates time-series values
using (var session = store.OpenSession())
{
  var baseline = DateTime.Today;

  IRavenQueryable<User> query = session.Query<User>()
      .Where(u => u.Name == "John");

  var result = query.ToList();

  TimeSeriesEntry[] val = session.TimeSeriesFor(result[0], "HeartRates")
      .Get(DateTime.MinValue, DateTime.MaxValue);

  session.SaveChanges();
}
```

#### Get entries with multiple values:

- Here, we check whether a stock's closing-time price is rising from day to day (over three days).  
  This example is based on the sample entries that were entered in [this example](https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/session/append.md#append-entries-with-multiple-values).

- Since each time series entry contains multiple StockPrice values,  
  we include a sample that uses [named time series values](https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/named-time-series-values.md)
  to make the code easier to read.

##### Native

```csharp
// Use Get without a named type
// Is the stock's closing-price rising?
bool goingUp = false;

using (var session = store.OpenSession())
{
  TimeSeriesEntry[] val = session.TimeSeriesFor("users/john", "StockPrices")
      .Get();

  var closePriceDay1 = val[0].Values[1];
  var closePriceDay2 = val[1].Values[1];
  var closePriceDay3 = val[2].Values[1];

  if ((closePriceDay2 > closePriceDay1)
      &&
      (closePriceDay3 > closePriceDay2))
      goingUp = true;
}
```

##### Named

```csharp
goingUp = false;

using (var session = store.OpenSession())
{
  // Call 'Get' with the custom StockPrice class type
  TimeSeriesEntry<StockPrice>[] val = session.TimeSeriesFor<StockPrice>("users/john")
      .Get();

  var closePriceDay1 = val[0].Value.Close;
  var closePriceDay2 = val[1].Value.Close;
  var closePriceDay3 = val[2].Value.Close;

  if ((closePriceDay2 > closePriceDay1)
      &&
      (closePriceDay3 > closePriceDay2))
      goingUp = true;
}
```

## Include parent and tagged documents

- When retrieving time series entries using `TimeSeriesFor.Get`,  
  you can include the series' parent document and/or documents referred to by the entries [tags](https://docs.ravendb.net/6.2/document-extensions/timeseries/overview.md#tags).

- The included documents will be cached in the session, and instantly retrieved from memory if loaded by the user.

- Use the following syntax to include the parent or tagged documents:

```csharp
// Get all time series entries
TimeSeriesEntry[] entries =
  session.TimeSeriesFor("users/john", "HeartRates")
      .Get(DateTime.MinValue, DateTime.MaxValue,
          includes: builder => builder
      // Include documents referred-to by entry tags
      .IncludeTags()
      // Include Parent Document
      .IncludeDocument());
```

## Syntax

```csharp
TimeSeriesEntry[] Get(DateTime? from = null, DateTime? to = null,
  int start = 0, int pageSize = int.MaxValue);
```

```csharp
//The stongly-typed API is used, to address time series values by name.
TimeSeriesEntry<TValues>[] Get(DateTime? from = null, DateTime? to = null,
int start = 0, int pageSize = int.MaxValue);
```

| Parameter | Type | Description |
| - | - | - |
| **from** | `DateTime?` | Get the range of time series entries starting from this timestamp (inclusive). <br /> Default: `DateTime.MinValue` |
| **to** | `DateTime?` | Get the range of time series entries ending at this timestamp (inclusive). <br /> Default: `DateTime.MaxValue` |
| **start** | `int` | Paging first entry. <br /> E.g. 50 means the first page would start at the 50th time series entry. <br /> Default: 0, for the first time-series entry. |
| **pageSize** | `int` | Paging page-size. <br /> E.g. set `pageSize` to 10 to retrieve pages of 10 entries. <br /> Default: `int.MaxValue`, for all time series entries. |

**Return Values**

- **`TimeSeriesEntry[]`** - an array of time series entry classes.

```csharp
public class TimeSeriesEntry
{
  public DateTime Timestamp { get; set; }
  public double[] Values { get; set; }
  public string Tag { get; set; }
  public bool IsRollup { get; set; }

  public double Value;

  //..
}
```

- **`TimeSeriesEntry<TValues>[]`** - Time series values that can be referred to [by name](https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/named-time-series-values.md).

## See also

- [Time Series API Overview](https://docs.ravendb.net/6.2/document-extensions/timeseries/client-api/overview.md)
- [Studio Time Series Management](https://docs.ravendb.net/6.2/studio/database/document-extensions/time-series.md)
- [Time Series Querying](https://docs.ravendb.net/6.2/document-extensions/timeseries/querying/overview-and-syntax.md)
- [Time Series Indexing](https://docs.ravendb.net/6.2/document-extensions/timeseries/indexing.md)
- [Time Series Rollup and Retention](https://docs.ravendb.net/6.2/document-extensions/timeseries/rollup-and-retention.md)
