title: Mongoose: How to use ObjectId to link models?
body: <p>I'm using Express, Mongoose and Mongodb. I have two Models, one for User, and another one for Review, like so:</p>
  
  <pre class="lang-js prettyprint-override"><code>var User = mongoose.Schema({
    firstName: String,
    lastName: String,
    email: String
  });
  mongoose.model("User", User);
  
  var Review = mongoose.Schema({
    foodRating: Number,
    serviceRating: Number,
    locationRating: Number,
    wouldReturn: boolean
  });
  mongoose.model("Review", Review);
  </code></pre>
  
  <p>I want to link both models, in a way that the reviews belongs to the user.</p>
  
  <p>I read about ObjectId, but it is not clear how to implement it. Should I create it, then use it, like so:</p>
  
  <pre><code>const MyObjectId = mongoose.Types.ObjectId;
  </code></pre>
  
  <p>then override the _id of the model I want to link to my first model with it?</p>
  
  <pre class="lang-js prettyprint-override"><code>var User = mongoose.Schema({
    firstName: String,
    lastName: String,
    email: String,
    review: [MyObjectId] // retrieves model below from its _id:MyObjectId
  });
  mongoose.model("User", User);
  
  var Review = mongoose.Schema({
    _id: MyObjectId, // overriding _id with ObjectId
    foodRating: Number,
    serviceRating: Number,
    locationRating: Number,
    wouldReturn: boolean
  });
  mongoose.model("Review", Review);
  </code></pre>
  
  <p>Is this correct? Or how would I do this?</p>