var modelProperties, mongoose, passportLocalMongoose, Rat, Schema, UserSchema;

mongoose = require( 'mongoose' );
passportLocalMongoose = require( 'passport-local-mongoose' );
Rat = require( './rat' );
Schema = mongoose.Schema;

modelProperties = {
  email: String,
  password: String,
  CMDRs: {
    default: [],
    type: [{
      autopopulate: true,
      type: Schema.Types.ObjectId,
      ref: 'Rat'
    }]
  }
};

UserSchema = new Schema( modelProperties );

UserSchema.methods.toJSON = function () {
  obj = this.toObject();
  delete obj.hash;
  delete obj.salt;
  return obj;
};

//UserSchema.plugin( require( 'mongoose-autopopulate' ) );

UserSchema.plugin( passportLocalMongoose, {
  usernameField: 'email'
});

module.exports = mongoose.model( 'User', UserSchema );

@@ -324,34 +324,8 @@
  %5B%7B%0A
-      autopopulate: true,%0A
     
@@ -559,68 +559,8 @@
 %7D;%0A%0A
-//UserSchema.plugin( require( 'mongoose-autopopulate' ) );%0A%0A
 User

Remove autopopulation from User model