title: Why is save not a function after assigning properties?
body: <p>TypeError: newUser.save is not a function (in the createNew function)</p>
  
  <p>Before assigning the properties with the spread operator, the userModel object has a save function (as designed by mongoose), however after the assign the function cannot be accessed anymore. Can someone explain why this is and how to get around it?</p>
  
  <pre><code>const mongoose = require('mongoose')
  
  const UserSchema = new mongoose.Schema({
    facebookid: String,
    firstname: String,
    lastname: String,
    email: String,
    timezone: Number,
    gender: String,
    invitationid: String,
    referralid: String,
    locale: String,
    stage: String
  })
  
  const User = mongoose.model('User', UserSchema)
  
  const createUser = () =&gt; new User()
  
  module.exports = {
    createNew : userInfo =&gt; {
  
      const userModel = createUser()
  
      const newUser =  { ...userModel,
        facebookid: userInfo.fid,
        firstname: userInfo.first_name,
        lastname: userInfo.last_name,
        locale: userInfo.locale,
        timezone: userInfo.timezone,
        gender: userInfo.gender,
        invitationid: userInfo.invitationid,
        referralid: userInfo.referralid,
        stage: 'NA'
      }
      return newUser.save()
    }
  }
  </code></pre>
  
  <p>Thanks for the help!
  Mate</p>