from the mongo console how do I export the profile data to a file
when I run this command db.system.profile.find( { millis : { $gt : 20000 } } ).pretty()
How do I get all the data into text file
from the mongo console how do I export the profile data to a file
when I run this command db.system.profile.find( { millis : { $gt : 20000 } } ).pretty()
How do I get all the data into text file
Depends on your OS. I have run the following on mac.
mongo --quiet --eval "db.system.profile.find( { millis : { $gt : 20000 } } ).pretty()" > dummy.json
--quiet
will ignore all the server info which you get at the start
--eval
will run the command for you. You can also run script as a js file. Simply remove the --eval
and "". And replace it with someScript.js