Repository navigation
Expand file tree
/
Copy pathmodels.js
More file actions
62 lines (48 loc) · 2.31 KB
/
Copy pathmodels.js
File metadata and controls
62 lines (48 loc) · 2.31 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// ===========================================================
// SCHEMA OBJECTS AND DATABASE CONNECTIONS
// ===========================================================
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/contributionsdb');
var Schema = mongoose.Schema
, ObjectId = Schema.ObjectId;
var Contribution = new Schema({
_id : ObjectId,
cmteId : String,
candId : String,
candNm : String,
contbrNm : String,
contbrCity : String,
contbrSt : String,
contbrZip : String,
contbrEmployer : String,
contbrOccupation : String,
contbReceiptAmt : String,
contbReceiptDt : Date,
receiptDesc : String,
memoCd : String,
memoText : String,
formTp : String,
fileNum : String
}, { collection : 'contribution' });
var CandidateTransactionSummary = new Schema({
_id : String,
value : {count: Number, amt: Number, candNm: String, contbrEmployer: String}
}, { collection : 'CandidateTransactionSummary' });
var MaxMinContribsPerCandidate = new Schema({
_id : String,
value : { min: {amt: Number, candNm: String, contbrNm: String, contbrEmployer: String},
max: {amt: Number, candNm: String, contbrNm: String, contbrEmployer: String}}
}, { collection : 'MaxMinContribsPerCandidate' });
var TotalContributionsByCompany = new Schema({
_id : String,
value : { min: {amt: Number, candNm: String, contbrNm: String},
max: {amt: Number, candNm: String, contbrNm: String}}
}, { collection : 'ContributionsByCompany' });
var ContributionModel = mongoose.model('contribution', Contribution);
var CandidateTransactionSummaryModel = mongoose.model('CandidateTransactionSummary', CandidateTransactionSummary);
var MaxMinContribsPerCandidateModel = mongoose.model('MaxMinContribsPerCandidate', MaxMinContribsPerCandidate);
var TotalContributionsByCompanyModel = mongoose.model('TotalContributionsByCompany', TotalContributionsByCompany);
module.exports.ContributionModel = ContributionModel
module.exports.CandidateTransactionSummaryModel = CandidateTransactionSummaryModel
module.exports.MaxMinContribsPerCandidateModel = MaxMinContribsPerCandidateModel
module.exports.TotalContributionsByCompanyModel = TotalContributionsByCompanyModel