title: login with email or username with MongoDB in Node.js
body: <p><strong>I am wondering if there is a way to let user to login with both username or email</strong>
  I searched a lot of times for but doesn't found a working method. I don't have a single idea how to do this, please help with the easiest way if possible. here is what my user schema looks like :</p>
  
  <pre><code>var mongoose = require("mongoose");
  var passportLocalMongoose = require("passport-local-mongoose");
  
  var UserSchema = new mongoose.Schema({
      fullname: String,
      username: { type : String , lowercase : true , unique: true ,  required: true, minlength: 3, maxlength: 10},
      email: String, 
      password: String,
      mobile: String,
      gender: String,
      profession: String,
      city: String,
      country: String,
      joining: {type: Date, default: Date.now}
  });
  
  UserSchema.plugin(passportLocalMongoose);
  
  module.exports = mongoose.model("User", UserSchema);
  </code></pre>
  
  <p>Addition info: I am working on top of nodejs.
  Any help is seriously appreciated.
  thnx </p>