Skip to content

Instantly share code, notes, and snippets.

@jdsiddon
Last active December 28, 2015 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jdsiddon/7441841 to your computer and use it in GitHub Desktop.
Save jdsiddon/7441841 to your computer and use it in GitHub Desktop.
/* 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);
@jdsiddon
Copy link
Author

The idea is to have a simple one-to-many relation, there should be multiple updates per site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment