-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopulate.js
372 lines (315 loc) · 8.72 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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
/*
This script creates the database, 5 comments, 5 users, and 5 posts
*/
// import module from `./models/db.js`
const db = require('./models/db.js');
var fs = require('fs');
/*
name of the collection (table)
to perform CRUD (Create, Read, Update, Delete) operations
*/
const {User, Post, Comment, Logger} = require('./models/content_db.js');
/*
calls the function createDatabase()
defined in the `database` object in `./models/db.js`
*/
populate();
async function populate(){
await db.connect();
////////////////////////////////////////////////////////////////////////////////////
/*
creates an object
*/
var userNew = {
username: 'Anyalover69',
pw: 'bfgbbgbsrgrtretr423568we90werhj324',
bio: `anya anya anya`,
dp:{
data: 1,
contentType: '',
},
userId: 90000001,
};
userNew.dp.data = fs.readFileSync('./public/images/prof_pics/anya.jpg');
userNew.dp.contentType = 'image/jpg';
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
await db.insertOne(User, userNew);
/*
creates an object
*/
var userNew = {
username: 'dankmeemer',
pw: 'strhysehbjsdfgl423568we90werhj324',
bio: `XDXDXD MEMER!!!`,
dp:{
data: 1,
contentType: '',
},
userId: 90000002,
};
userNew.dp.data = fs.readFileSync('./public/images/prof_pics/lmao.jpg')
userNew.dp.contentType = 'image/jpg';
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
await db.insertOne(User, userNew);
/*
creates an object
*/
var userNew = {
username: 'totallynotacatfish',
pw: 'rqaaaatrhysehbjwyertyrtgxxerhj324',
bio: `meow uwu`,
dp:{
data: 1,
contentType: '',
},
userId: 90000003,
};
userNew.dp.data = fs.readFileSync('./public/images/prof_pics/egril.jpg')
userNew.dp.contentType = 'image/jpg';
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
await db.insertOne(User, userNew);
/*
creates an object
*/
var userNew = {
username: 'HighTierHuman',
pw: 'r4w3eerddxczxzxhj7086546rsdfsdffe',
bio: `GRAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH`,
dp:{
data: 1,
contentType: '',
},
userId: 90000004,
};
userNew.dp.data = fs.readFileSync('./public/images/prof_pics/ltg.jpg')
userNew.dp.contentType = 'image/jpg';
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
await db.insertOne(User, userNew);
/*
creates an object
*/
var userNew = {
username: 'Trick1G',
pw: '67i78975urytgdfdxczxceeerqw543sdfswebbbawe',
bio: `LEAGUE PLAYER`,
dp:{
data: 1,
contentType: '',
},
userId: 90000005,
};
userNew.dp.data = fs.readFileSync('./public/images/prof_pics/trick.jpg')
userNew.dp.contentType = 'image/jpg';
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `profiles`
*/
await db.insertOne(User, userNew);
////////////////////////////////////////////////////////////////////////////////////
/*
creates an object
*/
var postNew = {
title: 'Wtf is wrong with Spy X Family',
content: 'When Anya received her first bolt, Henderson had stated that violence automatically gets 3 bolts. But, because of him, it was only 1. It doesnt change the fact that “Violence = 3 bolt”... But, what about that time she saved Ken? She saved a literally life. Loosing a life is more major, than a swollen cheek. (No hate. I love Damian.) Punching Damian for no justified reason would have cost her 3 bolts. But, saving the life of a drowning boy was only worth 1 Stella?',
score: 6345,
postId: 9000000000000001,
posterId: 90000001,
postDate: new Date("2022-03-24"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `posts`
*/
await db.insertOne(Post, postNew);
/*
creates an object
*/
var postNew = {
title: 'Ambatukam',
content: 'Dreamybulls real name is Perrell Laquarius Brown and he lives in North Carolina where he has a wife and two kids. He was born in 1992, making him 30 years old as of 2022.',
score: 2344,
postId: 9000000000000002,
posterId: 90000002,
postDate: new Date("2022-03-23"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `posts`
*/
db.insertOne(Post, postNew);
/*
creates an object
*/
var postNew = {
title: 'looking for pro ADC duo in LoL',
content: 'need an adc player (atleast Challenger) to boost me to diamond in league of legends please. i am bronze IV right now but its because my adc is always bad. i will meow for you everytime you get a kill. uWu',
score: 443,
postId: 9000000000000003,
posterId: 90000003,
postDate: new Date("2022-03-22"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `posts`
*/
await db.insertOne(Post, postNew);
/*
creates an object
*/
var postNew = {
title: 'You should exercise NOW!',
content: 'Regular exercise has been shown to help boost energy levels and enhance your mood',
score: 932,
postId: 9000000000000004,
posterId: 90000004,
postDate: new Date("2022-03-21"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `posts`
*/
await db.insertOne(Post, postNew);
/*
creates an object
*/
var postNew = {
title: 'Test Post #69',
content: 'test',
score: 3123,
postId: 9000000000000005,
posterId: 90000005,
postDate: new Date("2022-03-20"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `user` in the collection (table) `posts`
*/
await db.insertOne(Post, postNew);
////////////////////////////////////////////////////////////////////////////////////
/*
creates an object
*/
var commentNew = {
comment: 'ano daw',
commentId: 5000000000000001,
score: 234,
postId: 9000000000000003,
commenterId: 90000001,
parentId: 0,
postDate: new Date("2022-03-21"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `comment` in the collection (table) `comments`
*/
await db.insertOne(Comment, commentNew);
/*
creates an object
*/
var commentNew = {
comment: 'WAT',
commentId: 5000000000000002,
score: 3,
postId: 9000000000000001,
commenterId: 90000002,
parentId: 0,
postDate: new Date("2022-03-21"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `comment` in the collection (table) `comments`
*/
await db.insertOne(Comment, commentNew);
/*
creates an object
*/
var commentNew = {
comment: 'bruh moment',
commentId: 5000000000000003,
score: 877,
postId: 9000000000000004,
commenterId: 90000003,
parentId: 0,
postDate: new Date("2022-03-21"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `comment` in the collection (table) ` `
*/
await db.insertOne(Comment, commentNew);
/*
creates an object
*/
var commentNew = {
comment: 'xdd',
commentId: 5000000000000004,
score: 5,
postId: 9000000000000002,
commenterId: 90000004,
parentId: 0,
postDate: new Date("2022-03-21"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `comment` in the collection (table) `comments`
*/
await db.insertOne(Comment, commentNew);
/*
creates an object
*/
var commentNew = {
comment: 'WOW',
commentId: 5000000000000005,
score: 2,
postId: 9000000000000001,
commenterId: 90000005,
parentId: 0,
postDate: new Date("2022-03-21"),
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `comment` in the collection (table) `comments`
*/
await db.insertOne(Comment, commentNew);
/*
creates an object
*/
var loggerNew = {
loggedIn: true,
loggeduserId: 90000001
};
/*
calls the function insertOne()
defined in the `database` object in `./models/db.js`
stores the object `comment` in the collection (table) `comments`
*/
await db.insertOne(Logger, loggerNew);
}