-
Notifications
You must be signed in to change notification settings - Fork 0
/
seeds.js
40 lines (35 loc) · 808 Bytes
/
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
const mongoose = require('mongoose');
const Quote = require('./models/quotes');
mongoose.connect('mongodb://localhost:27017/quoteIt', { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => {
console.log("MONGO CONNECTION OPEN!!!")
})
.catch(err => {
console.log("OH NO MONGO CONNECTION ERROR!!!!")
console.log(err)
})
const seedQuotes = [
{
author: "Pete",
quote: "I love this thing so much",
},
{
author: "Luke",
quote: "I love lego",
},
{
author: "Charles",
quote: "Media team lmao",
},
{
author: "Tim",
quote: "Bing bong",
}
]
Quote.insertMany(seedQuotes)
.then(res => {
console.log(res)
})
.catch(e => {
console.log(e)
})