var mongoose = require('mongoose');
var timestamps = require('mongoose-timestamp');
var findOrCreate = require('mongoose-findorcreate');
var Schema = mongoose.Schema;

var User = new Schema({
  github_id: String,
  name: {type: String, index: true},
  username: String,
  access_token: {type: String, default: null}
}, {
  'collection': 'users',
  'versionKey': false
});

User.statics.findByParam = function (param, done) {
  UserModel.findOne({"$or":[
    {_id: param},
    {username: param},
    {github_id:param}
  ]}, done);
};

User.plugin(findOrCreate);

var UserModel = module.exports = mongoose.model('User', User);
@@ -201,24 +201,8 @@
 _id:
- String,%0A  name:
  %7Bty
@@ -229,20 +229,16 @@
 rue%7D,%0A  
-user
 name: St
@@ -241,16 +241,57 @@
 : String
+,%0A  username: %7Btype: String, index: true%7D
 ,%0A  acce

Correct indexes