Exporting output of a query in tabular format

Hi,
I want to copy the output of a query in tabular structure to paste it into MS Excel for comparison.
I tried copy pasting, but it doesn’t work. I tried on Robo 3T, Compass but it doesn’t support this functionality. Can anybody help me to export the output into a tabular structure.
Here is sample document.

Export to CSV. Then open the CSV using Excel program.

Thanks @Prasad_Saya for reply, as it is mentioned that the tool we have are only compass and robo. Basically it’s on client side (production) and we can’t add or remove services.
I know that we can import collections by using mongoExport commnad but here we have some limitation of tools. Once again thanks.

You can export from Compass or command-line mongoexport.

Ahan!, i tried but didn’t found any option to export all the documents(of a query output) using compass. can you tell me how can we export/copy all the documents from compass in a one go.

Its pretty simple. See: Compass - Export Filtered Subset of a Collection.

1 Like

If we want to export all the collection then we can use this option but I want to export the output of a collection. Kindly reread the question.

You have two options, and you can use one of them;

  1. Export filtered subset of collection.
  2. Export full collection.
1 Like

Ahan my bad. Yes it contain two options Thanks @Prasad_Saya

Using Mongo Compass we can export the collection(full collection and result of a query) for that follow the below steps:
1- Goto Collection menu from the menubar.
2- Click Export Collection.
image

3- Then a dialogue box will be opened.
i) untick the Export Full Collection option
ii) choose the output file format i.e. CSV
iii) choose the exporting path and file name
iv) click export button.

image

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.