title: Mongoose - Is it possible to access schema properties inside a mutation?
body: <p>Newbie here. I'm trying to create a movie recommendation app and I've been struggling with this authorization problem for a while now. My goal is to have a single user schema with a Boolean 'isAdmin' property to differentiate between ordinary users and admin users. The problem is that when I attempt to query the isAdmin variable in the mutation to ensure that the logged in user passed in from the context has the necessary privileges to perform the operation, I get undefined.</p>
  <p>User Schema</p>
  <pre><code>const userSchema = new mongoose.Schema({
      username: {
          type: String,
          index: {
              unique: true
          }
      },
      email: {
          type: String,
          required: true,
          index: {
              unique: true
          }
      },
      password: {
          type: String,
          required: true
      },
      contributions: {
          type: mongoose.Schema.Types.ObjectId,
          ref: 'Movie'
      },
      isAdmin: {
          type: Boolean,
          required: true,
          default: false
      }
  })
  </code></pre>
  <p>newMovie mutation</p>
  <pre><code>newMovie: async (parent, args, { models, user }) =&gt; {
          if (!user){
              throw new AuthenticationError('You must be signed in to submit a new movie')
          }
          console.log(user.isAdmin)
          if (user &amp;&amp; user.isAdmin === false) {
              throw new ForbiddenError('You are not qualified')
          }
          return await models.Movie.create({
              title: args.title,
              year: args.year,
              addedBy: mongoose.Types.ObjectId(user.id)
          })
      }
  </code></pre>
  <p>I attempted to console log user.isAdmin to see the value but instead I'm getting undefined. I have also tried using enum values 'user and admin' for a property 'roles' with the same result.</p>