Skip to content

Instantly share code, notes, and snippets.

@nanoninja
Created November 14, 2016 14:22
Show Gist options
  • Save nanoninja/0e98110606ed28a883f4ec9fdc116cc0 to your computer and use it in GitHub Desktop.
Save nanoninja/0e98110606ed28a883f4ec9fdc116cc0 to your computer and use it in GitHub Desktop.
MongoDB random dataset of scores
/**
* MongoDB fixtures
*
* Command: mongo dbname scores.js
*/
var names = ["exam", "essay", "quiz"];
for (var i = 0; i < 1000; i++) {
for (j = 0; j < 3; j++) {
db.scores.insert({"student": i, type: names[j], score: Math.round(Math.random()*100)});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment