-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseeds.js
86 lines (81 loc) · 2.91 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
var mongoose = require("mongoose");
var Campgrounds = require("./models/campground");
var Comments = require("./models/comments");
var data = [
{
name:"Manali",
image:"https://images.pexels.com/photos/417173/pexels-photo-417173.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
discription:"This place is great but i wish it had internet.",
},
{
name:"Kasol",
image:"https://images.pexels.com/photos/1020016/pexels-photo-1020016.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
discription:"This place is great but i wish it had internet.",
},
{
name:"Parvati",
image:"https://images.pexels.com/photos/361104/pexels-photo-361104.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
discription:"This place is great but i wish it had internet.",
},
{
name:"Snow Masti",
image:"https://images.pexels.com/photos/747964/pexels-photo-747964.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
discription:"This place is great but i wish it had internet.",
},
{
name:"Gangtok",
image:"https://images.pexels.com/photos/326058/pexels-photo-326058.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
discription:"This place is great but i wish it had internet.",
},
{
name:"Compton",
image:"https://images.pexels.com/photos/714258/pexels-photo-714258.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
discription:"This place is great but i wish it had internet.",
},
];
function seedDB() {
Campgrounds.remove({},function (err) {
// if (err)
// {
// console.log(err);
// }
// else
// {
// console.log("deleted all campgrounds");
// data.forEach(function (campground) {
//
// Campgrounds.create(campground,function (err,campground) {
// if (err)
// {
// console.log (err)
// }
// else{
// console.log("Created a campground");
// Comments.create({
// text:"This place is great but i wish it had internet",
// author:"The Rock"
// },function (err,comment) {
// if (err)
// {
// console.log(err);
// }
// else
// {
// console.log("Created comment");
// campground.comments.push(comment);
// campground.save();
// }
//
// })
//
// }
//
// })
//
// });
//
// }
//
});
};
module.exports = seedDB;