How can you import data to MongoDB using Compass?
In Compass, it has always been quite easy to import data – from JSON and CSV files – into a collection. With this new release, we’ve made it even easier and more powerful.
When you import JSON files, in addition to JSON lines files with Extended JSON, we now support importing from files containing JSON arrays, which is closer to how developers think, is a standard format for REST API responses, and is consistent with the functionality of mongoimport.
When it comes to importing CSV files, we’ve given you more control over what is being imported. You are now able to configure the separator that is used in the CSV file you are trying to import and you can also choose what fields should be imported. Additionally, for each field you can specify a data type; when something other than “String” is selected, the values will be converted automatically during the import operation without requiring additional batch operations after the import is completed.
How can you export data to MongoDB using Compass?
When your data is stored in MongoDB, you can query and aggregate it in many different ways to extract insights, and you can visualize your insights with MongoDB Charts. Sometimes, however, you may want to export your data (or a subset of it) to use it in other tools.
In Compass, exporting data is simple: just select a collection, optionally filter the data with a query and use the export functionality to save it as JSON or CSV.
Compass 1.21 contains also a number of under the hood improvements (connectivity, performance, security, etc.) and bug fixes that should improve your experience with Compass.
What else would you like to see in Compass to work more productively with MongoDB? Submit ideas and suggestions in our feedback portal!