Skip to content

Instantly share code, notes, and snippets.

@nidhhoggr
Created November 25, 2013 14:24
Show Gist options
  • Save nidhhoggr/7641919 to your computer and use it in GitHub Desktop.
Save nidhhoggr/7641919 to your computer and use it in GitHub Desktop.
Test schema modification suggestion
In order for Fieldset to have an objectId should something like the following exist:
var Fieldset = module.exports = new Schema({
name: { type: String, required: true },
key: { type: String, required: true },
repeatable: { type: Boolean, default: false },
ordinal: { type: Number }
});
var Test = module.exports = new Schema({
name: { type: String, required: true, index: { unique: true } },
key: { type: String, required: true },
abbreviation: { type: String, required: false },
unit: { type: ObjectId, required: false, ref: 'Unit' },
parent: { type: ObjectId, required: false, ref: 'Test' },
states: [{ type: String, required: false }],
companies: [{ type: ObjectId, required: false, ref: 'Company' }],
ordinal: { type: Number },
deleted: { type: Boolean, default: false },
fieldsets: [Fieldset],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment