-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloadTestData.js
More file actions
41 lines (39 loc) · 1.1 KB
/
loadTestData.js
File metadata and controls
41 lines (39 loc) · 1.1 KB
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
import { MongoClient } from 'mongodb';
import assert from 'assert';
import config from './config';
MongoClient.connect(config.mongodbUri, (err, db) => {
assert.equal(null, err);
db.collection('customers').insertMany([
{
"id": 1,
"name": "Stephen Siegel",
"age": "44",
"address": "1911 Gerald L. Bates Drive",
"city": "Boston",
"state": "MA",
"zip": "02110",
"interest": "Solar is the way to go because it's cleaner to the enviroment"
},{
"id": 2,
"name": "Adam May",
"age": "22",
"address": "3370 Sampson Street",
"city": "Denver",
"state": "CO",
"zip": "80202",
"interest": "I'm interested in solar because I want to be able to control my own energy costs"
},{
"id": 3,
"name": "Lisa M. Raines",
"age": "22",
"address": "1418 Apple Lane",
"city": "Galesburg",
"state": "IL",
"zip": "61401",
"interest": "Solar energy is cheap and reliable!"
}
]).then(response => {
console.info('Customers', response.insertedCount);
db.close();
});
});