diff --git a/app/schemas/models/earned_achievement.coffee b/app/schemas/models/earned_achievement.coffee index a78940d0d..34c2e2bd1 100644 --- a/app/schemas/models/earned_achievement.coffee +++ b/app/schemas/models/earned_achievement.coffee @@ -27,7 +27,7 @@ module.exports = triggeredBy: c.objectId() achievementName: type: 'string' created: type: 'date' - changed: type: 'date' + changed: type: ['date', 'string', 'number'] # TODO: migrate timestamps and Date objects all to ISO strings achievedAmount: type: 'number' earnedPoints: type: 'number' previouslyAchievedAmount: {type: 'number'} diff --git a/server/achievements/EarnedAchievement.coffee b/server/achievements/EarnedAchievement.coffee index f182c445c..a6442eeb7 100644 --- a/server/achievements/EarnedAchievement.coffee +++ b/server/achievements/EarnedAchievement.coffee @@ -10,7 +10,7 @@ EarnedAchievementSchema = new mongoose.Schema({ }, {strict:false}) EarnedAchievementSchema.pre 'save', (next) -> - @set('changed', Date.now()) + @set('changed', new Date()) next() EarnedAchievementSchema.index({user: 1, achievement: 1}, {unique: true, name: 'earned achievement index'}) diff --git a/server/levels/sessions/LevelSession.coffee b/server/levels/sessions/LevelSession.coffee index 7832875c0..46420907a 100644 --- a/server/levels/sessions/LevelSession.coffee +++ b/server/levels/sessions/LevelSession.coffee @@ -23,7 +23,7 @@ LevelSessionSchema.post 'init', (doc) -> LevelSessionSchema.pre 'save', (next) -> User = require '../../users/User' # Avoid mutual inclusion cycles - @set('changed', new Date()) + @set('changed', new Date().toISOString()) id = @get('id') initd = id of previous