Skip to content

Instantly share code, notes, and snippets.

@kf0jvt
Last active December 22, 2015 12:09
Show Gist options
  • Save kf0jvt/6470693 to your computer and use it in GitHub Desktop.
Save kf0jvt/6470693 to your computer and use it in GitHub Desktop.
Top Ten largest data breaches in the VCDB by record count. #vcdb #javascript
foo = db.vcdb.aggregate([
{ $unwind : "$victim" },
{ $project : { _id : 0,
data_total : "$attribute.confidentiality.data_total",
incident : "$timeline.incident",
victim_id : "$victim.victim_id" } },
{ $sort : { "data_total" : -1 } },
{ $limit : 10 }
]);
bar = foo['result']
for (var i=0; i < bar.length; i++) {
print(bar[i].data_total + " " + bar[i].victim_id + bar[i].incident['year']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment