Skip to main content

Session: Delete Incremental Time Series

Delete a range of incremental time series entries using IncrementalTimeSeriesFor.Delete.

IncrementalTimeSeriesFor.Delete

IncrementalTimeSeriesFor.Delete is used for the removal of incremental time series and their entries.

  • There is no need to explicitly delete an incremental time series; the series is deleted when all its entries are deleted.
  • Attempting to delete nonexistent entries results in a no-op, generating no exception.

Syntax

  • There are two IncrementalTimeSeriesFor.Delete methods:
    • Delete a range of time series entries
      -or-
      if values are omitted, delete the entire series.
// Delete incremental time series values range from .. to,
// or, if values are omitted, delete the whole series.
void Delete(DateTime? from = null, DateTime? to = null);
  • Delete a single time series entry.
// Delete the entry value at the specified time stamp
void Delete(DateTime at);
  • Parameters

    ParametersTypeDescription
    from (optional)DateTime?Delete the range of entries starting at this timestamp.
    to (optional)DateTime?Delete the range of entries ending at this timestamp.
    atDateTimeTimestamp of the entry to be deleted.
  • Return Value
    No return value.

  • Exceptions

    • DocumentDoesNotExistException is thrown If the document doesn't exist.
    • Attempting to delete nonexistent entries results in a no-op and does not generate an exception.

Usage Flow

  • Open a session
  • Create an instance of IncrementalTimeSeriesFor and pass it:
  • Call IncrementalTimeSeriesFor.Delete.
  • Call session.SaveChanges for the action to take effect on the server.

Code Samples

  • Delete a single entry:
// Delete a single entry
using (var session = store.OpenSession())
{
session.IncrementalTimeSeriesFor<Downloads>("companies/webstore")
.Delete(baseline.AddMinutes(1));

session.SaveChanges();
}
  • Delete a range of entries:
// Delete a range of entries from the time series
using (var session = store.OpenSession())
{
session.IncrementalTimeSeriesFor("companies/webstore", "INC:Downloads")
.Delete(baseline.AddDays(0), baseline.AddDays(9));

session.SaveChanges();
}