-
Notifications
You must be signed in to change notification settings - Fork 0
/
seed.js
82 lines (77 loc) · 1.8 KB
/
seed.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
const Log = require("./models/logs.js")
const mongoose = require("mongoose")
// requiring this "middleware" in this javascript seed file solved issue
require('dotenv').config()
const mongoURI = process.env.MONGO_URI
const db = mongoose.connection
// connect to the database
mongoose.connect(mongoURI)
// designing after the fruits Seed.js ==> so node CLI command
Log.create([
{
name: "Gore",
date: "2023-09-05",
time: "10:10",
mood: 5,
description: "Wow I just had an Uncrustable French Toast, so good.",
tags: [ "so delicious" ],
color: "#325343"
},
{
name: "Gore",
date: "2023-09-05",
time: "14:33",
mood: 1,
description: "Bootstrap exists.",
tags: [ "CSS", "bootstrap" ],
color: "#106967"
},
{
name: "Gore",
date: "2023-09-05",
time: "18:30",
mood: 4,
description: "Class started, I am so here for this.",
tags: [ "SEI", "GA" ],
color: "#bd93f9"
},
{
name: "Gore",
date: "2023-09-05",
time: "19:00",
mood: 5,
description: "In 'n Out is actually terrible.",
tags: [ "food" ],
},
{
name: "Gore",
date: "2023-09-05",
time: "19:30",
mood: 5,
description: "I'm actually NOT a potato like I always say.",
tags: [ "not a potato" ],
color: "#44475a"
},
{
name: "Gore",
date: "2023-09-06",
time: "06:30",
mood: 3,
description: "Half-asleep, time to develop some amazing designs because I'm gifted like that.",
tags: [ "Michelin Star" ],
color: "#314268"
},
{
name: "Gore",
date: "2023-09-06",
time: "12:50",
mood: 5,
description: "Hash maps are pretty helpful for solving algo problems.",
tags: [ "programming" ],
color: "#8f8ec4"
},
]).then((log) => {
console.log(log)
// close the database -- mongoose
db.close()
})