-
Notifications
You must be signed in to change notification settings - Fork 0
/
patientSeed.js
81 lines (79 loc) · 2.09 KB
/
patientSeed.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
const mongoose = require("mongoose"),
Patient = require("./models/patient");
mongoose.Promise = global.Promise;
mongoose.connect(
process.env.MONGODB_URI || "mongodb://localhost:27017/docucare",
{ useNewUrlParser: true }
);
Patient.remove({})
.then(() => {
return Patient.create({
name: {
first: "Erika",
last: "Wright"
},
gender: "female",
DOB: new Date('1995, 11, 7')
});
})
.then(patient => console.log(patient.fullName))
.then(() => {
return Patient.create({
name: {
first: "Paul",
last: "Mitchell"
},
gender: "male",
DOB: new Date('1987, 8, 13')
});
})
.then(patient => console.log(patient.fullName))
.then(() => {
return Patient.create({
name: {
first: "Felicia",
last: "Escobar"
},
gender: "female",
DOB: new Date('1996, 2, 1')
});
})
.then(patient => console.log(patient.fullName))
.then(() => {
return Patient.create({
name: {
first: "Marcus",
last: "Henry"
},
gender: "male",
DOB: new Date('1978, 12, 11')
});
})
.then(patient => console.log(patient.fullName))
.then(() => {
return Patient.create({
name: {
first: "Celine",
last: "Fontes"
},
gender: "female",
DOB: new Date('2001, 5, 13')
});
})
.then(patient => console.log(patient.fullName))
.then(() => {
return Patient.create({
name: {
first: "Bonnie",
last: "Emerson"
},
gender: "female",
DOB: new Date('1990, 4, 15')
});
})
.then(patient => console.log(patient.fullName))
.catch(error => console.log(error.message))
.then(() => {
console.log("DONE");
mongoose.connection.close();
});