'How to export a MongoDB database to JSON?

It is possible to export a mongodb database to json on windows? I've already searched and the only thing that I find is to export collections. Is that the only way?



Solution 1:[1]

Here's an example for a collection

mongoexport --collection=mycollection --db=mydb --out=myoutput.json

Use mongodump for the whole database

mongodump -d mydb -o output.json

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1