title: Mongoose virtual populate returns null
body: <p>I'm setting up a backend on mongoose and GraphQL and I'm having some issues with virtual populate in mongoose.</p>
  
  <p>This is a node.js application running on version 5.4.0 of mongoose and version 11.5.0 of node. I've attempted to follow these two guides without success</p>
  
  <p><a href="http://thecodebarbarian.com/mongoose-virtual-populate" rel="nofollow noreferrer">http://thecodebarbarian.com/mongoose-virtual-populate</a>
  <a href="https://thecodebarbarian.com/mongoose-4.13-virtual-populate-dynamic-refs-fields" rel="nofollow noreferrer">https://thecodebarbarian.com/mongoose-4.13-virtual-populate-dynamic-refs-fields</a></p>
  
  <pre><code>const gameStatusSchema = new mongoose.Schema({
      userID: String,
      gameID: { type: mongoose.Schema.Types.ObjectId, ref: "Game"},
      gameStatus: Number
  }, {
      timestamps: true,
      toObject: { virtuals: true },
      toJSON: { virtuals: true }
  });
  
  const gameSchema = new mongoose.Schema({
      gameTitle: String,
      gameDescription: String,
      gameType: Number,
      gameTypeID: String,
      gamePosition: Number,
  }, {
      timestamps: true,
      toObject: { virtuals: true },
      toJSON: { virtuals: true }
  });
  
  gameSchema.virtual("gameStatus", {
      ref: "GameStatus",
      localField: "_id",
      foreignField: "gameID",
      justOne: true
  });
  
  const newGame = await Game.findById(id)
  .populate("gameStatus");
  console.log(newGame);
  </code></pre>
  
  <p>The newGame object doesn't even contain the gameStatus property. If i add <code>.toJSON({virtuals: true})</code> gameStatus shows as null.</p>
  
  <p>Below are examples of the JSON objects from mongo</p>
  
  <pre><code>gameStatus object
  {
      "_id" : ObjectId("5c473a872721eb7327377fa2"),
      "userID" : "5c3629deed4593ab3b435614",
      "gameID" : ObjectId("5c472bc4b6b5f745bbbd7f6a"),
      "gameStatus" : 8
  }
  
  game Object
  {
      "_id" : ObjectId("5c472bc4b6b5f745bbbd7f6a"),
      "gameTitle" : "Lotto",
      "gameDescription" : "Test",
      "gameType" : 1,
      "gameTypeID" : "5c472bc4b6b5f745bbbd7f69",
      "gamePosition" : 8,
      "course" : ObjectId("5c35e5e53757a7a29c33565f"),
      "createdAt" : ISODate("2019-01-22T14:42:12.267Z"),
      "updatedAt" : ISODate("2019-01-22T14:42:12.267Z"),
      "__v" : 0
  }
  </code></pre>
  
  <p>I would expect the code above to let me query my game object and get the game object with the virtually populated gameStatus object, but it returns null. Would love it if someone can take a look at my problem.</p>