title: E11000 duplicate key error collection in a UNDEFINED value. How avoid this?
body: <p>I'm making a project with node, mongoose and express.</p>
  
  <p>I have this schema in mongoose</p>
  
  <pre><code>const userSchema = new Schema({
    local: {
      email: {
        type: String,
        lowercase: true,
        unique: true,
        ....
      },
      password: {
        type: String
      }
    },
    google: {
      googleId: String,
      email: String
    },
    ....
  };
  </code></pre>
  
  <p>Because i have two passport strategies (local for the classic email, password and google).</p>
  
  <p>But when i create two accounts with different google accounts. The console shows me this error:</p>
  
  <pre><code>{ MongoError: E11000 duplicate key error collection: xxx.users index: local.email_1 dup key: { : null }
  </code></pre>
  
  <p>WHAT?? The "Unique" detect duplicated two undefined values?</p>
  
  <p>So. How can i avoid this?</p>
  
  <p>Thank you :)</p>