A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/drivers/csharp/current/time-series/ below:

Time Series Collections - C#/.NET Driver

In this guide, you can learn how to use and interact with time series collections in MongoDB using the MongoDB .NET/C# Driver.

Time series collections efficiently store sequences of measurements over a period of time. Time series data consists of any data collected over time, metadata that describes the measurement, and the time of the measurement.

Example

Measurement

Metadata

Sales Data

Revenue

Company

Infection Rates

Amount of People Infected

Location

Important

Time series collections require MongoDB 5.0 or later.

To create a time series collection, pass the following parameters to the CreateCollection() method:

var database = mongoClient.GetDatabase("fall_weather");var tsOptions = new TimeSeriesOptions("temperature");var collOptions = new CreateCollectionOptions { TimeSeriesOptions = tsOptions };database.CreateCollection("september2021", collOptions);

To check if you successfully created the collection, use the ListCollections() or ListCollectionsAsync() method as shown in the following example:

var collections = database.ListCollections().ToList();foreach (var collection in collections) {    Console.WriteLine(collection);}

Your output will look similar to the following:

{   "name": "september2021",   "type": "timeseries",   "options": {      "timeseries": {         "timeField": "temperature",         "granularity": "seconds",         "bucketMaxSpanSeconds": 3600      }   },   "info": {      "readOnly": false   }}...

To query a time series collection, follow the conventions for retrieving and aggregating data. For more information about these conventions, see the Retrieve Data and Aggregation Operations guides.

To learn more about the operations mentioned on this page, see the following Server manual guides:

To learn more about any of the methods or types discussed in this guide, see the following API documentation:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4