How do i export only the name of the columns from mongodb?

965 Views Asked by At

I am new to mongodb and my task is to export metadata about all collections in a database. I know little about shell scripting and i am not able to understand the documents provided on mongodb website.

I am using Mongodb compass 4.2.14 and though i am able to export the collection, i am not able to just export the column names.

How do i export just the column names and also how to view the metadata?

1

There are 1 best solutions below

0
prasad_ On

In Compass GUI, select the Schema TAB, and click the Analyze button. This will show the data types for each field for a collection.

To get a copy of the schema, from the top-left menu, select the Collection -> Share Schema as JSON menu item. This will copy the schema to the Clipboard. You can then paste from the clipboard into any text file/editor of your choice.

Reference: Compass - Analyze Schema.