-
Notifications
You must be signed in to change notification settings - Fork 0
/
dummyData.js
45 lines (41 loc) · 843 Bytes
/
dummyData.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var Poll = require('./models/poll');
module.exports = function () {
Poll.count().exec( function(err, count) {
if (count > 0) {
return;
}
var defaultPoll1 = new Poll({
title: 'Question 1',
choices: [{
title: 'Choice 1',
votes: 2
}, {
title: 'Choice 2',
votes: 1
}, {
title: 'Choice 3',
votes: 5
}],
owner: 'blerg'
});
var defaultPoll2 = new Poll({
title: 'Question 2',
choices: [{
title: 'Choice 1',
votes: 5
}, {
title: 'Choice 2',
votes: 5
}, {
title: 'Choice 3',
votes: 10
}],
owner: 'blerg'
});
Poll.create([defaultPoll1, defaultPoll2], (error) => {
if (!error) {
console.log('db seeded...');
}
});
});
};