-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathadd_data.js
177 lines (157 loc) · 4.63 KB
/
add_data.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*
This script creates the database
and inserts 8 user details in the collection `profiles`
*/
// import module from `./models/db.js`
const db = require('./models/db.js');
/*
name of the collection (table)
to perform CRUD (Create, Read, Update, Delete) operations
*/
const collection = 'profiles';
/*
calls the function createDatabase()
defined in the `database` object in `./models/db.js`
*/
db.createDatabase();
/*
creates an object
containing first name, last name, username, and bio of a user
*/
var user = {
fName: 'Ned',
lName: 'Stark',
username: 'LordHandStark',
bio: `You think my life is some precious thing to me?
That I would trade my honour for a few more years of...of what?!
You grew up with actors; you learned their craft and you learnt it well.
But I grew up with soldiers. I learned how to die a long time ago.`
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
db.insertOne(collection, user);
/*
creates an object
containing first name, last name, username, and bio of a user
*/
var user = {
fName: 'Bran',
lName: 'Stark',
username: 'BranTheBroken',
bio: `It wasn't for the murder that the Gods cursed the Rat Cook,
or for serving the King's son in a pie. He killed a guest beneath his roof.
That's something the Gods can't forgive.`
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
db.insertOne(collection, user);
/*
creates an object
containing first name, last name, username, and bio of a user
*/
var user = {
fName: 'Jon',
lName: 'Snow',
username: 'TheWhiteWolf',
bio: `I'm not going to swear an oath I can't uphold.
When enough people make false promises, words stop meaning anything.
Then there are no more answers, only better and better lies.`
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
db.insertOne(collection, user);
/*
creates an object
containing first name, last name, username, and bio of a user
*/
var user = {
fName: 'Sansa',
lName: 'Stark',
username: 'QueenInTheNorth',
bio: `I'm A Slow Learner, It's True. But I Learn.`
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
db.insertOne(collection, user);
/*
creates an object
containing first name, last name, username, and bio of a user
*/
var user = {
fName: 'Arya',
lName: 'Stark',
username: 'FacelessMan',
bio: `Not today.`
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
db.insertOne(collection, user);
/*
creates an object
containing first name, last name, username, and bio of a user
*/
var user = {
fName: 'Cersei',
lName: 'Lannister',
username: 'QueenMother',
bio: `When you play the Game of Thrones you win, or you die.
There is no middle ground.`
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
db.insertOne(collection, user);
/*
creates an object
containing first name, last name, username, and bio of a user
*/
var user = {
fName: 'Tyrion',
lName: 'Lannister',
username: 'TheHalfman',
bio: `Never forget what you are. The rest of the world will not.
Wear it like armor, and it can never be used to hurt you`
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
db.insertOne(collection, user);
/*
creates an object
containing first name, last name, username, and bio of a user
*/
var user = {
fName: 'Daenerys',
lName: 'Targaryen',
username: 'BreakerOfChains',
bio: `Lannister, Targaryen, Baratheon, Stark, Tyrell –
they’re all just spokes on a wheel. This one’s on top,
then that one’s on top, and on and on it spins,
crushing those on the ground. I’m not going to stop the wheel.
I’m going to break the wheel.`
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
db.insertOne(collection, user);