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

How do you make Studio 3T export MongoDB collections to unique files? #Studio3T_AMA

Posted on: 15/09/2021 (last updated: 22/09/2021) by Dj Walker-Morgan

Q: Help! I’ve been using Studio 3T to regularly export MongoDB collections to track our international shipments, but when I went to check the data, I found it has been overwriting previous exports. While I’m rebuilding my historical data, I want to know is there any way to force scheduled exports to write to a uniquely named file each time?

Welcome to the latest Studio 3T Ask Manatees Anything – #Studio3T_AMA. Want to know how to use Studio 3T to make your MongoDB life better? Just tweet and use #Studio3T_AMA or email [email protected].

A: It is true that, historically, when an Export Task was run on Studio 3T, each Export Unit wrote its results to the file. That file is at the filename and path which is shown in the Export Unit’s destination field. If that file/filename wasn’t changed between runs of the Task, the files that were previously generated there are overwritten with the new results. The filename was unchanging by default.

Enter Placeholders For Export

Or at least that has been the case until Studio 3T 2021.6 and the introduction of placeholders. Placeholders are small text snippets that are automatically replaced with dynamic text when the export unit is used to write a file. There are three placeholders currently:

  • ${datetime} is replaced by the date and time in YYYY-MM-DD_HH-MM-SS format
  • ${date} is replaced by the date in YYYY-MM-DD format
  • ${time} substitutes the placeholder with the time in HH-MM-SS format

Where a filename field can make use of placeholders, you’ll find a ${} icon next to it. Clicking on the drop box next to it will reveal all the placeholders available:

The export destination field has a placeholder menu.
The Placeholder Menu

Selecting one of the placeholders in the menu here will insert the text into the file name at the current cursor position. You can type the placeholder string yourself if you wish. If you want to go back to the original generated filename, with no placeholders, just select Reset to default. 

You can use a placeholder anywhere in the filename, including in the directory path. So say you have something like:

        /home/dj/myexports/exports${date}/report1-${time}.json

This will create a date-stamped directory with the time-stamped exported file in it. Similarly you can make a date-time-stamped directory to hold all the named exported files in it. 

Going Global

You won’t just find placeholders in the Export destinations fields. If you look in the Export Options, you’ll find you can use them as defaults in a task. This makes it easy to apply dynamic settings across entire Export Tasks.

Global Options for Export tasks include the ability to set folder and generated filename settings
Placeholders in Export Global Options

In Studio 3T 2021.5, this setting for target was just one field, now it’s two, one for the directory and one for the filename, and both support placeholders. There’s also one extra placeholder for the filename field here. The ${exportsource} placeholder is the name of the database and/or collection or query which is acting as the source of the data. You can mix that in with the data and time fields, or, as in the example above, just create a new dated directory for the export.

With placeholders you have the freedom to lay out your exports in a whole new organized structure on your disk. Or you can simply date-time-stamp your export files when you Export MongoDB data and never accidentally overwrite files again.


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.

Related articles

  • How do I make my scripts quieter with MongoDB? #Studio3T_AMA
  • What is the fastest way to make a database connection? #Studio3T_AMA
  • AMA: How can Studio 3T’s Tasks make me more efficient?
  • 3T Software Labs integrates with Hackolade to make Data Modernization projects easier
  • Studio 3T, Licenses and You

Tags

2022 academy aggregation AMA atlas christmas community connections culture date tags events export features hackolade import intellishell In Use JSON knowledge base migration modelling mongodb mongoodb productivity query regex releases schema security SQL Studio 3T tasks time series tips updates webinar windows

Browse by MongoDB topic

  • Connecting to MongoDB
  • Database Administration & Security
  • Getting Started with MongoDB
  • Getting Started with Studio 3T
  • Import/Export
  • Job Automation & Scheduling
  • MongoDB Aggregation Framework
  • MongoDB/Studio 3T Workshops
  • Performance
  • Query & CRUD Operations
  • Reference
  • Schema
  • Studio 3T Licensing
  • Support and other resources
  • Working with MongoDB & SQL
  • Working with MongoDB Atlas

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

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