-
Notifications
You must be signed in to change notification settings - Fork 0
/
populate.js
96 lines (88 loc) · 2.42 KB
/
populate.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
87
88
89
90
91
92
93
94
95
96
'use strict';
var _mongoose = require('mongoose');
var _mongoose2 = _interopRequireDefault(_mongoose);
var _movie = require('./models/movie');
var _movie2 = _interopRequireDefault(_movie);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var movies = [{
title: 'La La Land',
poster: 'https://i.imgur.com/po7UezG.jpg',
genre: 'Drama/Romance'
}, {
title: 'Paterson',
poster: 'https://i.imgur.com/pE0C9E0.jpg',
genre: 'Drama/Comedy'
}, {
title: 'Jackie',
poster: 'https://i.imgur.com/VqUi1sw.jpg',
genre: 'Drama/Biography'
}, {
title: 'Lo and Behold Reveries of the Connected World',
poster: 'https://i.imgur.com/s106X7S.jpg',
genre: 'Documentary'
}, {
title: '10 Cloverfield Lane',
poster: 'https://i.imgur.com/kV2BVdH.jpg',
genre: 'Drama'
}, {
title: 'Birth of a Nation',
poster: 'https://i.imgur.com/a6HJj8S.jpg',
genre: 'Fantasy/Myster'
}, {
title: 'De Palma',
poster: 'https://i.imgur.com/oOIa73M.jpg',
genre: 'Documentary'
}, {
title: 'Doctor Strange',
poster: 'https://i.imgur.com/kyHDVOk.jpg',
genre: 'Fantasy/Science Fiction'
}, {
title: 'Eddie the Eagle',
poster: 'https://i.imgur.com/GNrdAuF.jpg',
genre: 'Drama/Sport'
}, {
title: 'Pride and prejudice and zombies',
poster: 'https://i.imgur.com/KhbG0Lw.jpg',
genre: 'Thriller/Action'
}, {
title: 'Finding Dory',
poster: 'https://i.imgur.com/BTexHYJ.jpg',
genre: 'Comedy/Adventure'
}, {
title: 'Green Room',
poster: 'https://i.imgur.com/Q0Ysh7L.jpg',
genre: 'Crime/Thriller'
}, {
title: 'Kubo and the Two Strings',
poster: 'https://i.imgur.com/uTFCKZc.jpg',
genre: 'Fantasy/Adventure'
}, {
title: 'In a Valley of Violence',
poster: 'https://i.imgur.com/DTtJ62G.jpg',
genre: 'Drama/Western'
}, {
title: 'O.J.: Made in America',
poster: 'https://i.imgur.com/T8uc6x8.jpg',
genre: 'Documentary'
}, {
title: 'Rogue One: A Star Wars Story',
poster: 'https://i.imgur.com/zOF2iYc.jpg',
genre: 'Science Fiction/Action'
}, {
title: 'Sing Street',
poster: 'https://i.imgur.com/C3ExEb6.jpg',
genre: 'Drama/Romance'
}, {
title: 'Zoolander 2',
poster: 'https://i.imgur.com/ejlIijD.jpg',
genre: 'Comedy'
}];
// Connect to MongoDB
_mongoose2.default.connect('mongodb://localhost/movies');
// Go through each movie
movies.map(function (data) {
// Initialize a model with movie data
var movie = new _movie2.default(data);
// and save it into the database
movie.save();
});