-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseeds.js
60 lines (56 loc) · 2.76 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
var mongoose = require("mongoose");
var Dog = require("./models/dog");
var Comment = require("./models/comment");
var data = [
{
name: "Jax",
breed: "Mutt",
age: 5,
image: "https://i.imgur.com/tvQolxd.jpg",
desc: "Spicy jalapeno bacon ipsum dolor amet spare ribs pork pancetta sirloin, beef pig tri-tip pork belly. Flank tail bresaola, tri-tip porchetta frankfurter jerky tenderloin doner. Jerky tongue meatloaf, pork belly porchetta cupim picanha. Ground round tri-tip corned beef, sausage doner prosciutto ribeye bacon shank chuck."
},
{
name: "Whiskey",
breed: "Shitzu",
age: 5,
image: "https://i.ytimg.com/vi/iNSHAwQDxtg/hqdefault.jpg",
desc: "Ground round brisket andouille kielbasa tail shank pastrami strip steak turducken meatball venison short loin turkey flank. Turkey ribeye pig cupim, landjaeger sausage porchetta cow rump bresaola sirloin boudin. Short loin frankfurter kevin ribeye cow turducken biltong jerky ham meatball. Alcatra shankle swine shank salami picanha, pork pastrami turkey short ribs burgdoggen tri-tip. Tri-tip shank hamburger sausage. Pork loin tenderloin filet mignon pig pork."
},
{
name: "Scarlet",
breed: "King Charles Cavalier",
age: 2,
image: "http://www.yourpurebredpuppy.com/dogbreeds/photos-CD/cavalierkingcharlesspanielsf2.jpg",
desc: "Ribeye porchetta tri-tip sirloin biltong flank. Drumstick ham pancetta salami, sausage t-bone brisket sirloin corned beef bacon chicken pork loin ham hock prosciutto beef ribs. Landjaeger pork belly alcatra bresaola, turkey hamburger buffalo jerky ball tip swine bacon. Kevin venison boudin prosciutto chuck burgdoggen. Kielbasa pork loin turducken turkey porchetta kevin meatball pork chop ham fatback."
}
]
function seedDB(){
Dog.remove({}, function(err){
if(err){
console.log(err);
}
console.log("Removed campground!");
data.forEach(function(seed){
Dog.create(seed, function(err, dog){
if(err){
console.log(err);
} else {
console.log("Added campground!");
Comment.create({
text: "This dog is great, but I wish I could ride them!",
author: "Alinea"
}, function(err, comment){
if(err){
console.log(err);
} else {
dog.comments.push(comment);
dog.save();
console.log("Created new comment")
}
});
}
});
});
});
}
module.exports = seedDB;