From 5fd095165da2580741e5ea267bbaf16758547db0 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Mon, 2 Sep 2013 15:54:32 -0400 Subject: [PATCH] temp fix to #1388 --- src/models/user.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/models/user.js b/src/models/user.js index f04d6d54ab..fadb2348d1 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -121,16 +121,19 @@ var UserSchema = new Schema({ str: String }, - eggs: [ - { - text: String, // Wolf - name: String, // Wolf - value: Number, //3 - notes: String, //Find a hatching potion to pour on this egg, and one day it will hatch into a loyal pet. - //type: String, //Egg // FIXME this is forcing mongoose to return object as "[object Object]", but I don't think this is needed anyway? - dialog: String //You've found a Wolf Egg! Find a hatching potion to pour on this egg, and one day it will hatch into a loyal pet - } - ], + + // FIXME revert this back to definition once we've replaced Derby and can run a migration to remove all corrupt eggs + eggs: Schema.Types.Mixed, +// [ +// { +// text: String, // Wolf +// name: String, // Wolf +// value: Number, //3 +// notes: String, //Find a hatching potion to pour on this egg, and one day it will hatch into a loyal pet. +// //type: String, //Egg // this is forcing mongoose to return object as "[object Object]", but I don't think this is needed anyway? +// dialog: String //You've found a Wolf Egg! Find a hatching potion to pour on this egg, and one day it will hatch into a loyal pet +// } +// ], hatchingPotions: Array, //["Base", "Skeleton",...] lastDrop: { date: Date, @@ -229,6 +232,10 @@ var UserSchema = new Schema({ UserSchema.post('init', function(doc) { /* Fix corrupt values, FIXME we can remove this after off Derby*/ + doc.items.eggs = _.filter(doc.items.eggs,function(egg){ + return !_.isString(egg); + }) + _.each(doc.tasks, function(task, k) { if ((task != null ? task.id : void 0) == null) { return delete doc.tasks[k];