-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpersons.js
48 lines (43 loc) · 1.49 KB
/
persons.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
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
var communitySchema = new Schema({
name : String,
_id: Schema.Types.ObjectId,
Location: String,
Community_head: String,
});
var streetSchema = new Schema({
name: String,
_id: Schema.Types.ObjectId,
community_id : {type: Schema.Types.ObjectId, ref: "Community"},
Location: String,
YOC : Date
});
var familySchema = new Schema({
name: String,
_id: Schema.Types.ObjectId,
Head: String,
size: Number,
Street_id: {type: Schema.Types.ObjectId, ref:"Street"},
annual_income: String
});
var personsSchema = new Schema({
family_id: {type: Schema.Types.ObjectId, ref: "Family"},
_id: Schema.Types.ObjectId,
name: String,
mothers_name: {type: Schema.Types.ObjectId, ref: "Persons"},
fathers_name: {type: Schema.Types.ObjectId, ref: "Persons"},
mothers_maidenname: {type: Schema.Types.ObjectId, ref: "Persons"},
citizenship: String,
age: Number,
Address: String,
Sex: String,
Spouse_name: {type: Schema.Types.ObjectId, ref: "Persons"},
siblings: [{type: Schema.Types.ObjectId, ref: "Persons"}],
children: [{type: Schema.Types.ObjectId, ref: "Persons"}],
ExSpouse_name: {type: Schema.Types.ObjectId, ref: "Persons"},
});
var Community = mongoose.model("Community", communitySchema);
var Street = mongoose.model('Street', streetSchema);
var Family = mongoose.model("Family", familySchema);
var Persons = mongoose.model("Persons", personsSchema);