title: User.findOrCreate is not a function passport-facebook
body: <p>I have followed the github guide of <a href="https://github.com/jaredhanson/passport-facebook" rel="nofollow">passport-facebook</a> and this is the result I've been getting:</p>
  
  <blockquote>
    <p>User.findOrCreate is not a function</p>
  </blockquote>
  
  <p>I have this code in my passport.js:</p>
  
  <pre><code>passport.use(new FacebookStrategy({
      clientID        : configAuth.facebookAuth.clientID,
      clientSecret    : configAuth.facebookAuth.clientSecret,
      callbackURL     : configAuth.facebookAuth.callbackURL
      },
      function(accessToken, refreshToken, profile, done) {
      User.findOrCreate({ facebookId: profile.id }, function (err, user) {
      return done(err, user);
      });
      }
  ));
  </code></pre>
  
  <p>Do I need to write the findOrCreate method myself? I thought mongoose was handling this?</p>
  
  <p>Also, what does profile.id do? Do I need to edit that to something relevant to my code? I don't have a model named profile.</p>
  
  <p>This is my user model:</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  var ObjectId = Schema.ObjectId;
  var crypto = require('crypto');
  var jwt = require('jsonwebtoken');
  
  var UserSchema = new mongoose.Schema({
      username: { type: String, lowercase: true, unique: true },
      firstname: { type: String},
      lastname: { type: String},
      difficulty: { type: String},
      isstudent: { type: Boolean },
      haschildren: { type: Boolean},
      gender: { type: String },
      email: { type: String, unique: true},
      birthdate: String,
      isdoingchallenges: { type: Boolean },
      challengescompleted: [{ type: ObjectId, ref: 'Challenge' }],
      currentchallenge: { type: ObjectId, ref: 'Challenge' },
      challengessuggestions: [{ type: ObjectId, ref: 'Challenge' }],
      isfacebooklogin:{type:Boolean},
      facebookid:{type:String},
      hash: String,
      salt: String
  });
  
  UserSchema.methods.setPassword = function(password){
      this.salt = crypto.randomBytes(16).toString('hex');
      this.hash = crypto.pbkdf2Sync(password, this.salt, 1000, 64).toString('hex');
  };
  
  UserSchema.methods.validPassword = function(password) {
      var hash = crypto.pbkdf2Sync(password, this.salt, 1000, 64).toString('hex');
      return this.hash === hash;
  };
  
  UserSchema.methods.generateJWT = function() {
  
      // set expiration to 60 days
      var today = new Date();
      var exp = new Date(today);
      exp.setDate(today.getDate() + 60);
  
      return jwt.sign({
          _id: this._id,
          username: this.username,
          exp: parseInt(exp.getTime() / 1000),
      }, 'SECRET');
  };
  
  mongoose.model('AppUser', UserSchema);
  </code></pre>