-
Notifications
You must be signed in to change notification settings - Fork 0
/
seeds.js
61 lines (58 loc) · 2.07 KB
/
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
53
54
55
56
57
58
59
60
61
var mongoose = require('mongoose');
var Campgrounds = require('./models/campgrounds.js');
var Comment = require('./models/comment.js');
//seed data
let data =[
{
name : "camp1",
image : "https://q9m3bv0lkc15twiiq99aa1cy-wpengine.netdna-ssl.com/wp-content/uploads/2019/07/TENT.jpeg",
description: "verygdubaervjbaourhvoaj v"
},
{
name : "camp2",
image : "https://q9m3bv0lkc15twiiq99aa1cy-wpengine.netdna-ssl.com/wp-content/uploads/2019/07/TENT.jpeg",
description: "verygdubaervjbaourhvoaj AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv"
},
{
name : "camp3",
image : "https://q9m3bv0lkc15twiiq99aa1cy-wpengine.netdna-ssl.com/wp-content/uploads/2019/07/TENT.jpeg",
description: "verygdubaervjbaourhvoaj sdbuoae'inipbirwnbkbfdbv9jevckwePwonvWHEIOVHWJV v"
}
]
function seedDb(){
//remove campgronds
Campgrounds.remove({},(err)=>{
// if(err){
// console.log(err);
// }
// else{
// console.log('campgropunds removed');
// }
// //add campgrounds
// data.forEach((seed)=>{
// Campgrounds.create(seed,(err,campdata)=>{
// if(err){
// console.log(err);
// }
// else{
// console.log('campground created');
// Comment.create({
// text: "this is beautiful site but without connectivity",
// author: 'ishaan desai'
// },(err,comment)=>{
// if (err) {
// console.log(err);
// }
// else{
// console.log(comment);
// campdata.comments.push(comment);
// campdata.save();
// console.log('comment added');
// }
// });
// }
// })
// });
});
}
module.exports = seedDb;