title: How do i access usernameField and change its value to email according to this javascript library?
body: <p>Here is the code i wrote to use a nodejs library called passport-local-mongoose. And part of the documentation for this library, states that you can change the usernameField to "email" in order for passport-local to use email instead of username when authenticating. I'm new to JavaScript and i am struggling to use the options parameter to change the usernameField to "email" according to this documentation under the options section.
  <a href="https://github.com/saintedlama/passport-local-mongoose" rel="nofollow noreferrer">https://github.com/saintedlama/passport-local-mongoose</a></p>
  
  <p>Here is my code</p>
  
  <pre><code>var mongoose              = require("mongoose"),
      passportLocalMongoose = require("passport-local-mongoose");
  
  var Schema = mongoose.Schema;
  //Creates a user credentials schema
  var UserSchema = new Schema({
    username: String,
    password: String
  });
  
  //Set the schema to use passport-local-mongoose
  UserSchema.plugin(passportLocalMongoose);
  
  //Export the user model to app.js
  module.exports = mongoose.model("User", UserSchema);
  </code></pre>