-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathseeds.js
52 lines (44 loc) · 1023 Bytes
/
seeds.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
46
47
48
49
50
51
52
// initial dummy data for articles and user
var mongoose = require('mongoose');
var Article = require('./models/Article.js');
var User = require('./models/User.js');
// mongoose.connection.dropDatabase(error => {
// console.log('Database not dropped');
// //process.exit(0);
// });
var user = {
email: '[email protected]',
password: '12345678',
firstName: 'TD',
lastName: 'BD',
username: 'TD-BD',
provider: 'local'
};
user = new User(user);
user.save();
// var initial = [{
// title: "article 1",
// content: "content for article 1 ",
// user:user
// },
// {
// title: "article 2",
// content: "content for article 2 ",
// user:user
// },
// {
// title: "article 3",
// content: "content for article 3 ",
// user:user
// }
// ]
// initial.forEach(function(article) {
// var articles = new Article(article);
// articles.save(function(err,data){
// if(err){
// throw err;
// }
// else{
// }
// });
// });