title: Is there a way to get rid of [Object: null prototype] in GraphQL
body: <p>I'm trying to make one-to-many relationship database with <code>Mongoose</code> and <code>GraphQL</code>.</p>
  
  <p>Whenever I insert the data to GraphQL mutation argument, I will get <code>[Object: null prototype]</code> error.</p>
  
  <p>I notice the object will have <code>[Object: null prototype]</code> in front of it when I tried to <code>console.log</code> for debug purpose.</p>
  
  <p>I have tried many ways, tried to <code>map()</code> args or even to use <code>replace()</code> but no luck. All I have been getting is <code>"args.ingredient.map/replace is not a function"</code></p>
  
  <p>I have test hard coded method by changing the args for example:</p>
  
  <pre><code>args.category = '5c28c79af62fad2514ccc788'
  args.ingredient = '5c28c8deb99a9d263462a086'
  </code></pre>
  
  <p>Surprisingly it works with this method. I assume the input cannot be an object but just an ID.</p>
  
  <p>Refer below for actual results.</p>
  
  <p>Resolvers</p>
  
  <pre><code>Query: {
      recipes: async (root, args, { req }, info) =&gt; {
          return Recipe.find({}).populate('ingredient category', 'name createdAt').exec().then(docs =&gt; docs.map(x =&gt; x))
      },
  },
  Mutation: {
      addRecipe: async (root, args, { req }, info) =&gt; {
        // args.category = '5c28c79af62fad2514ccc788'
        // args.ingredient = '5c28c8deb99a9d263462a086'
        // console.log(args.map(x =&gt; x))
        return Recipe.create(args)
      }
  }
  </code></pre>
  
  <p>TypeDef</p>
  
  <pre><code>extend type Mutation {
      addRecipe(name: String!, direction: [String!]!, ingredient: [IngredientInput], category: [CategoryInput]): Recipe
  }
  
  type Recipe {
      id: ID!
      name: String!
      direction: [String!]!
      ingredient: [Ingredient!]!
      category: [Category!]!
  }
  
  input IngredientInput {
      id: ID!
  }
  
  input CategoryInput {
      id: ID!
  }
  </code></pre>
  
  <p>Models</p>
  
  <pre><code>const recipeSchema = new mongoose.Schema({
      name: String,
      direction: [String],
      ingredient: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Ingredient' }],
      category: { type: mongoose.Schema.Types.ObjectId, ref: 'Category' }
  }, {
      timestamps: true // createdAt, updateAt
  })
  
  const Recipe = mongoose.model('Recipe', recipeSchema)
  </code></pre>
  
  <p>This is the result I console log the args when inserting the data</p>
  
  <pre><code>{ 
      name: 'Butter Milk Chicken TEST2',
      direction: [ 'Step1', 'Step2', 'Step3' ],
      ingredient:[[Object: null prototype] { id: '5c28c8d6b99a9d263462a085' }],
      category: [[Object: null prototype] { id: '5c28c79af62fad2514ccc788' }]
  }
  </code></pre>
  
  <p>I assume I need to get something like this</p>
  
  <pre><code>{ 
      name: 'Butter Milk Chicken TEST2',
      direction: [ 'Step1', 'Step2', 'Step3' ],
      args.category = ['5c28c79af62fad2514ccc788']
      args.ingredient = ['5c28c8ccb99a9d263462a083', '5c28c8d3b99a9d263462a084', '5c28c8d6b99a9d263462a085']
  }
  </code></pre>