title: Creating a Foreign Key relationship in Mongoose
body: <p>I'm beginning with Mongoose and I want to know how to do this type of configuration:</p>
  <p><img src="https://i.stack.imgur.com/lAjmo.png" alt="enter image description here" /></p>
  <p>A recipe has different ingredients.</p>
  <p>I have my two models:</p>
  <p>Ingredient and Recipe:</p>
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  var IngredientSchema = new Schema({
      name: String
  });
  
  module.exports = mongoose.model('Ingredient', IngredientSchema);
  </code></pre>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  var RecipeSchema = new Schema({
      name: String
  });
  
  module.exports = mongoose.model('Recipe', RecipeSchema);
  </code></pre>