Home »
MCQs »
MongoDB MCQs
Amongst which of the following MongoDB command is used to export the data?
41. Amongst which of the following MongoDB command is used to export the data?
- mongoexport
- mongoimport
- mongodelete
- None of the mentioned above
Answer: A) mongoexport
Explanation:
To export the data, the mongoexport command in MongoDB is utilised. Using the command-line tool mongoexport, you can generate a JSON or CSV export of data that is stored in a MongoDB instance. A CSV or JSON file can be created to contain either the entire collection or a specific field from the collection. Similarly, a CSV or JSON file can be imported into a collection and vice versa. In order to accomplish this, we should use the following syntax:
mongoexport --db DB_NAME --collection COLLECTION_name --fields Field_name(s) --type=[csv or JSON} --out=Name-Path-Output-File