Last active
December 28, 2015 04:19
-
-
Save jdsiddon/7441841 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* sites.js */ | |
var | |
mongoose = require('mongoose') | |
, Schema = mongoose.Schema | |
, update = require('./updates') | |
; | |
//Define the site model | |
var siteSchema = new Schema({ | |
client: String, | |
siteUrl: String, | |
siteMaintenanceRequirements: String, | |
siteLastMaintenance: [update], | |
siteContractActive: Boolean | |
}); | |
module.exports = mongoose.model('site', siteSchema); | |
/* updates.js */ | |
var | |
mongoose = require('mongoose') | |
, Schema = mongoose.Schema | |
, ObjectId = Schema.ObjectId | |
; | |
//Define the site model | |
var updateSchema = new Schema({ | |
maintenanceDescription: String, | |
person: String, | |
date: Date | |
}); | |
module.exports = mongoose.model('update', updateSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The idea is to have a simple one-to-many relation, there should be multiple updates per site.