Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Blog
    • Community
    • Testimonials
    • Whitepapers
    • Reports
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Careers
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • Download
  • My 3T
search

Studio 3T® Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

Time Series Collections in Studio 3T

Posted on: 31/10/2022 by Dj Walker-Morgan

MongoDB’s Time Series collections are a way of more efficiently indexing and storing the data which makes up a time series, without the overhead of each data point containing multiple repetitions of the same fields. 

There are three components to a time series record. Firstly, it includes the acquisition time for the data. Then identification for the source, called the metadata field. Finally, the measurements taken for the data point. 

A time series collection may appear to be a normal collection. Behind the scenes though, MongoDB is managing a system collection for the data which compresses each source’s measurements into one bucket document. When a bucket document is full, MongoDB creates a new bucket document. This reduces the storage requirement and enables queries to be more efficient. 

This does mean that you have to create the collection explicitly as a time series collection. 

Creating a Time Series collection in Studio 3T

When you add a new collection, the option to Create a Time Series Collection is available. Select this option and then configure the Time Series collection settings, Time Field, Meta Field, Granularity and Expire After Seconds.

How to create a Time Series collection in Studio 3T
The Add New Collection dialog

Time Field: This will be the name of the field that contains the time information for a datapoint.

Meta Field: This is  the name of a field which will contain information about the source – this may be an embedded document where there are multiple fields identifying a source, but there will only be one Meta field containing that data. This field is optional, but note that you can only use the Meta Field field to identify data for updates and deletion.

Granularity: This field defaults to seconds. It hints to MongoDB how granular your time series is, allowing it to optimize around minute or hourly updates. 

Expire After Seconds: This is another optional field. When set, the automatic removal of data points that are older than the seconds value in this field takes place. 

You will need to enter a collection name, a Time Field name and a Meta Field name. Then you can click Create to create your Time Series collection.

Querying a Time Series collection in Studio 3T

You can use the Studio 3T Collections Tab, Aggregation Editor or IntelliShell to query your Time Series collections like every other MongoDB collection. There are some things to note though.

  • Update and Delete operations are restricted by MongoDB Time Series collection limitations. Specifically:
    • Update and Delete queries can only match on the meta field values, so document deletion by reference to the _id field is not possible.
      • This means that the queries generated by default in the update and remove dialogs will not be valid without rewriting.
    • Updates may only change the metaField values.
    • You cannot use limit to restrict the number of documents to be updated. All updates must have multi: true set or use UpdateMany().
    • Upserts are not available.
  • Time Series collections manifest as writable non-materialized views. As such, they are also subject to View Limitations.

Duplicate _ids

While normal MongoDB collections do not allow entries with duplicate _id values, Time Series collections do. This is due to the way the data is stored in the “compressed” format in another table. There, the original id is saved alongside the readings.

Because of this, there are limitations on Studio 3T as to how they can handle duplicated data. These limitations affect import, copy and migration tools which offer “insertion options” upon detecting duplicate _id. These tools will not be able to detect the duplicate _id values and will insert duplicates into the time series collection. 

Importing from JSON

It is currently not possible to import JSON data as a time series collection. The import process is not aware of the data being time series data. It will therefore import it as a normal collection. Importing into an already existing Time Series collection will generate an error. This applies currently to all importable data formats. One option is to import as a normal collection and then follow the MongoDB guide Migrate Data into a Time Series Collection which involves creating a transient collection, backing that up and restoring it into a time series collection.

Mongodump and Time Series Collections

You can dump Time Series collections by exporting using Mongodump BSON from Studio 3T’s Export tool. When you restore this data using Studio 3T’s import Mongodump BSON, the collection will import as a time series collection. When importing Time Series collections like this, set –-noIndexRestore to ensure no warnings about a lack of indexes.

You should only restore Time Series collections like this; if you are restoring other normal collections, you may wish to restore them separately so you can restore their indexes.


How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Dj Walker-Morgan

Dj has been around since Commodore had Pets and Apples grew everywhere. With a background in Unix and development, he's been around the technology business writing code or writing content ever since.

Article navigation

Related articles

  • MongoDB Time Series Collections Explained
  • What’s so good about Time Series Collections?
  • What’s new in Studio 3T 2022.9 – Time Series and default Mongosh
  • How do you make Studio 3T export MongoDB collections to unique files? #Studio3T_AMA
  • What’s New in Studio 3T 2020.9 | Query Manager, Elapsed Time Indicator & More

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2023 3T Software Labs Ltd. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum

We value your privacy

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data.

By clicking “Accept all”, you consent to the storage of cookies and the processing of personal data for these purposes, including any transfers to third countries. By clicking on “Decline all”, you do not give your consent and we will only store cookies that are necessary for our website. You can customize the cookies we store on your device or change your selection at any time - thus also revoking your consent with effect for the future - under “Manage Cookies”, or “Cookie Settings” at the bottom of the page. You can find further information in our Privacy Policy.
Accept all
Decline all
Manage cookies
✕

Privacy Preference Center

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data. Please choose for which purposes you wish to give us your consent and store your preferences by clicking on “Accept selected”. You can find further information in our Privacy Policy.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Google Analytics

Google Ads

Bing Ads

Facebook

LinkedIn

Quora

Hotjar

Reddit

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

HubSpot

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected