blob: 6f5beaf0f9eb9e1ad59178b8f81b35933f54d5ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import mongoose from 'mongoose';
import Promise from 'bluebird';
import app from './app';
mongoose.connect('mongodb://localhost:27017/which', { useNewUrlParser: true });
const users = [
{ name: "Emma" },
{ name: "Elise" },
{ name: "Jack" },
{ name: "Oliver" },
{ name: "Jamie" },
{ name: "Aidan" },
{ name: "Jordan" },
{ name: "Erin" },
{ name: "William" },
{ name: "Ethan" },
];
Promise.map(users, async user => {
return await app.service('users').create(user);
}).catch(e => console.error(e))
.finally(() => mongoose.disconnect());
|