We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40b804f commit 1cecd02Copy full SHA for 1cecd02
populateDb.ts
@@ -0,0 +1,28 @@
1
+import mongoose from 'mongoose';
2
+import app from './app';
3
+
4
+mongoose.connect('mongodb://localhost:27017/which', { useNewUrlParser: true });
5
6
+import UserModel from './models/users/user.model';
7
+(async () => {
8
+ const users = [
9
+ { name: "Emma" },
10
+ { name: "Elise" },
11
+ { name: "Jack" },
12
+ { name: "Oliver" },
13
+ { name: "Jamie" },
14
+ { name: "Aidan" },
15
+ { name: "Jordan" },
16
+ { name: "Erin" },
17
+ { name: "William" },
18
+ { name: "Ethan" },
19
+ ];
20
+ try {
21
+ for (const user of users) {
22
+ await UserModel.create(user);
23
+ }
24
+ } catch (e) {
25
+ console.error(e);
26
27
+ mongoose.disconnect();
28
+})();
0 commit comments