Skip to content

Instantly share code, notes, and snippets.

@ovaillancourt
Created March 29, 2012 17:48
Show Gist options
  • Save ovaillancourt/2240707 to your computer and use it in GitHub Desktop.
Save ovaillancourt/2240707 to your computer and use it in GitHub Desktop.
Super-transport-code-not-populating
var mongoose = require('mongoose')
,Schema = mongoose.Schema;
var BusStop = require('./BusStop.js');
var BusScheduleSchema = require('./BusSchedule.js').schema;
var BusStopSchema = BusStop.schema;
var RouteRateSchema = require('./RouteRate.js').schema;
var StopEntrySchema = new Schema({
order: {type: Number, min:0, required: true}
,stopId: {type: Schema.ObjectId, ref: 'BusStop'}
});
var BusRouteSchema = new Schema({
name: {type: String, required: true}
,description: String
,color: {type: String, uppercase: true, validate: /^\#[0-9a-fA-F]{6}$/, default: '#FFFFFF'}
,active: {type: Boolean, default: false}
,stops: [StopEntrySchema]
,schedules: [BusScheduleSchema]
,routeRates: [RouteRateSchema]
},{strict: true});
module.exports = mongoose.model('BusRoute', BusRouteSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment