Errbit: export all parameters of a specific problem to JSON file

Little protip.
NOTE 1: this protip is useful for Errbit + MongoDB
NOTE 2: I’m not an expert in Errbit and MongoDB. Waiting for suggestions in comments :)
NOTE 3: I hope that we have more useful methods to do this, but I’ve not found them.
If you need to export all parameters of a specific problem to JSON file, you should get problem_id. Go the problem page, problem_id is in URL after the problems/
https://errbit.your-project.com/apps/602069ee9f440473d6402110/problems/60236b0f9f440479d8f75949
Our id is 60236b0f9f440479d8f75949. Don’t mix up with app_id
.
Then you should go to your environment where errbit is deployed (server) and run this command. And run this
mongo errbit_production --quiet --eval "db.notices.find({ err_id: db.errs.findOne({ problem_id: ObjectId(\"60236b0f9f440479d8f75949\")})._id }).toArray()" > errors.json
here errbit_production
is errbit database name in mongo.
And now can find your data in error.json
file.
When it’s exactly a JSON, but you can fix it by removing ObjectId
and ISODate
type names from the text. I’ve written this script to fix it (Ruby):
Magic!