[#1711] taskSchema back to doc so we can use .id(). The performacne hit isn't

drastic, it was the history entries that was hurting us
This commit is contained in:
Tyler Renelle 2013-11-02 17:09:24 -07:00
parent e84aa13d62
commit c5d3d142d9

View file

@ -12,7 +12,7 @@ var _ = require('lodash');
// Task Schema
// -----------
var TaskSchema = {
var TaskSchema = new Schema({
_id:{type: String,'default': helpers.uuid},
id: String,
history: Array, // [{date:Date, value:Number}], // this causes major performance problems
@ -33,6 +33,11 @@ var TaskSchema = {
winner: String // user.profile.name
// group: {type: 'Strign', ref: 'Group'} // if we restore this, rename `id` above to `challenge`
}
};
});
TaskSchema.pre('save', function(next){
this.id = this.id || this._id;
next()
})
module.exports.schema = TaskSchema;