started change to faster method of populating exercise list field

This commit is contained in:
2013-01-23 17:05:28 -05:00
parent eb4ed9b84b
commit 300e7223a0
2 changed files with 64 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
var mongoose = require('mongoose');
var Schema = require('mongoose').Schema;
var UserSchema = new mongoose.Schema({
username: {type: String, unique: true, required: true},
@@ -6,7 +7,7 @@ var UserSchema = new mongoose.Schema({
password: String,
is_admin: {type: Boolean, 'default': false },
is_imperial: {type: Boolean, 'default': false },
favorites: [{type: [Schema.ObjectId], ref: 'Exercise'}]
favorites: [{ type: Schema.ObjectId, ref: 'Exercises'}]
});
UserSchema.methods.recentworkouts = function(callback) {