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
    • AI Helper
    • Team Sharing
    • Index Manager
    • 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 I export (or copy and paste) particular columns of data? #Studio3T_AMA

Posted on: 23/11/2021 by Dj Walker-Morgan

Q: In the Table View, how do I export (or copy and paste) particular columns of data with Studio 3T?

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: There’s a couple of ways to select columns for copy and paste in the Table View. We’re going to show you two ways, a hands-on one using the Table View’s Hide Column, and a ready-to-automate one using MongoDB projection.

The big plus with using Projection to filter down your columns is that unlike hiding columns, the selection can work with Export, SQL Migration and other operations that can use a query as a source. Then you can move on from copying and pasting by hand, to fully automating the exporting of data.

Let’s start with the Table View’s Hide Column first.

Hiding Columns for Copy and Paste

Let’s start with a quick and dirty solution, because everyone loves those. First hide all the columns you don’t want in your export, using the Control+T (Command+T) show/hide column toggle. If you get a bit overzealous and hide everything, don’t worry. Here’s the customers example, completely hidden:

All columns hidden in the Table View

Notice that you can still select columns and when you do, the column name is displayed in the breadcrumb trail above. And Control+T (Command+T) is a toggle, so you can bring back any column to visibility. You can, of course, be sensible and only hide the columns you aren’t interested in. So let’s select the email and date of birth columns and make them visible again:

Two Columns visible in a Table View ready for copy and paste

Now, let’s do Control+A (Command+A) to select all the rows in this view (all 200 in this case), and then pop up the context menu with a right click. Select Copy ➡ Copy Selected Documents as CSV (or any other copy type as required). The hidden columns will not be included in the copy. To restore your view, use the context menu on the table and select Column ➡ Make All Columns Visible.

Project Yourself

If you want to minimize the time you spend hiding columns, then you want to get MongoDB to help with its project option. Project lets you select the fields you want to display in your results and skip all the others. You can build a projection really quickly using the Visual Query Builder. Drag the fields you want to keep in your view into the drop area in the Projection section and they’ll automatically be included for you:

Projecting just email and dob columns for exporting or copy and paste

When you start a projection, remember every other field (apart from _id) will be excluded, so if its name is not in the list, it won’t appear. If you look at the Projection field in the Query Bar:

You’ll see how the Visual Query Builder translates that to MongoDB query language. You can, of course, manually type your own projections.

If we now run that query, we get this result:

Results from the projection include the _id column which we don't want to copy and paste

Ah yes, remember how we mentioned that the _id field was, by default, included. Well, here it is. Quickest way to make it disappear is by just hiding the column with Control/Command+T.

Projecting _id

What if you included _id in the projection and set it to exclude like this:

Adding _id to the projection to make it easier to copy and paste

That would be a projection of { _id:0, email:1, dob:1 }. What would happen then? Well, this:

Results with no _id values, but still an _id column appears when you exclude _id.

Yes, the _id column still appears (because this is a table and _id fields are essential to the table’s functionality) but its contents are empty. If you Copy as CSV documents from this, the _id field will be included in the rows with an empty string value.

The solution again is to hide the column. But do note that if you flip over to Tree or JSON views you’ll find the _id is completely omitted from those views. It only appears in Tables as an artifact. Once you’ve hidden the _id you can select and Copy from the results.

The Copy Menu has a range of options with CSV available with and without headers.

As we mentioned at the start, using projection unlocks the ability to use Export, SQL Migrations and other 3T tools with your column selection. Then you can move on from copying and pasting only the visible documents by hand, to fully automated export of all the documents in the collection using Studio 3T’s Tasks and Task scheduler.

Your Copy, Your Paste

Essentially, both techniques work side by side. Hiding columns is great for ad-hoc copying of data. Using projections is great for starting and working with queries you’ll want to automate later. Whichever you choose, Studio 3T gives you options.


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 copy and paste plain JSON from Studio 3T? #Studio3T_AMA
  • What’s New in Studio 3T 2022.4 – Date Tags, Smarter Columns, Saving SQL Mappings
  • How do you make Studio 3T export MongoDB collections to unique files? #Studio3T_AMA
  • Studio 3T SQL Export or Migration? #STUDIO3T_AMA
  • Copy MongoDB Query Results to CSV, Excel & Google Sheets

Tags

2022 academy aggregation AMA atlas Certification christmas community connections culture date tags events export features hackolade import intellishell In Use JSON knowledge base migration modelling mongodb mongoodb mongosh My 3T productivity product management query regex releases schema security SQL Studio 3T studio3t 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

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
✕