0

I am a beginner and trying to import data from MongoDB. The Robo3T which I use for visualization shows something like below.

--Kins
    Kins

And this is the command I use

mongoexport --db kins --collection test --out output.json

mongoexport --db kins.kins --collection test --out output.json

mongoexport --db [kins].[kins] --collection test --out output.json

But none of them work. What's the correct syntax?

How to import data in json format. Please guide me.

Link I reviewed:

Dump Mongo Collection into JSON format

enter image description here

Unbreakable
  • 7,776
  • 24
  • 90
  • 171

1 Answers1

0

I guess you want to use the --jsonArray (docs) flag because by default mongoexport writes data using one JSON document for every MongoDB document.

mongoexport --db kins.kins --collection test --out output.json --jsonArray

You can consider using the --pretty (docs) flag too. It will output documents in pretty-printed format.

Goran Stoyanov
  • 2,311
  • 1
  • 21
  • 31