-
Notifications
You must be signed in to change notification settings - Fork 0
/
seeds.js
66 lines (54 loc) · 2.33 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
var mongoose=require("mongoose");
var newarticles=require("./models/blog");
var comment=require("./models/comment");
var data=[
{
image:"https://fthmb.tqn.com/ksK97eLxTzH94uERSweL1mcGNGU=/768x0/filters:no_upscale():max_bytes(150000):strip_icc()/hacker-Gu-577f9e9d3df78c1e1fb0b9c4.jpg",
paragraph:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type",
tag:"Technology"
},
{
image:"https://darkwebnews.com/wp-content/uploads/2017/09/Hacker-with-Rised-Handed.jpg",
paragraph:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a typem",
tag:"Technology"
},
{
image:"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQUI-xTervRv3kCfc2E2sGp309uA-QL0H0e52Qq_IARX9hsaEzi",
paragraph:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type",
tag:"Technology"
}
]
function seedDb(){
newarticles.remove({},function(err){
if (err) {
console.log(err)
}
else{
console.log("Content Removed")
}
});
// data.forEach(function(blog){
// newarticles.create(blog,function(err,cblog){
// if(err){
// console.log(err);
// }
// else{
// console.log("added succesfully");
// comment.create({
// text:"Lorem Ipsum is simply dummy text of the printing and typesetting industry",
// author:"Vishal"
// },function(err,comment){
// if(err){
// console.log(err);
// }
// else{
// cblog.comments.push(comment);
// cblog.save();
// console.log("Created new comment");
// }
// })
// }
// })
// })
}
module.exports=seedDb;