Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use people
- (function() {
- var names = [
- 'Yolanda',
- 'Iska',
- 'Malone',
- 'Frank',
- 'Foxton',
- 'Pirate',
- 'Poppelhoffen',
- 'Elbow',
- 'Fluffy',
- 'Paphat'
- ]
- var randName = function() {
- var n = names.length;
- return [
- names[Math.floor(Math.random() * n)],
- names[Math.floor(Math.random() * n)]
- ].join(' ');
- }
- var randAge = function(n) {
- return Math.floor(Math.random() * n);
- }
- for (var i = 0; i < 1000; ++i) {
- var person = {
- name: randName(),
- age: randAge(100)
- }
- if (Math.random() > 0.8) {
- person.cat = {
- name: randName(),
- age: randAge(18)
- }
- }
- db.people.insert(person);
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement