Skip to content

Instantly share code, notes, and snippets.

@anstak
Created May 11, 2017 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anstak/8a8cb436bbd97636f5f64438cb2c6d2f to your computer and use it in GitHub Desktop.
Save anstak/8a8cb436bbd97636f5f64438cb2c6d2f to your computer and use it in GitHub Desktop.
MongoDB export
global_log = {};
var cursor = db.getCollection('log').find({}, {});
while(cursor.hasNext()) {
var obj = cursor.next();
delete obj._id;
if (obj.result) {
if (obj.result._id) delete obj.result._id;
global_log[obj.active_period_id] = obj;
}
}
print(tojson(global_log));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment