title: User.findOne() is not a function
body: <pre><code>passport.use('local-signup', new LocalStrategy({
      // by default, local strategy uses username and password, we will override with email
      usernameField : 'email',
      passwordField : 'password',
      passReqToCallback : true // allows us to pass back the entire request to the callback
  },
  (req, email, password, done) =&gt; {
      // asynchronous
      // User.findOne wont fire unless data is sent back
      process.nextTick(() =&gt; {
  
      // find a user whose email is the same as the forms email
      // we are checking to see if the user trying to login already exists
      User.findOne({ 'email' :  email },function(err, user){
          // if there are any errors, return the error
  
          if (err)
              return done(err);
  
          // check to see if theres already a user with that email
          if (user) {
              return done(null, false, {'errorMessages': 'That email is already taken.'});
          } else {
  
              // if there is no user with that email
              // create the user
              let newUser            = new User();
  
              // set the user's local credentials
              newUser.name       = req.body.fullname;
              //newUser.email          = email;
              newUser.password       = newUser.generateHash(password);
  
  
              // save the user
              newUser.save((err)=&gt;{
                  if (err)
                      return done(err);
                  return done(null, newUser);
              });
          }
      });    
      });
  }));
  </code></pre>
  
  <p>The above code is in node js using passport js authentication and the code of local-signup is not working.</p>
  
  <p>In the above code i am getting the error:</p>
  
  <p><code>User.findOne() is not a function</code>.</p>
  
  <p>My schema is all right... please help</p>