title: How do I create a oneToMany relationship between two Mongoose schemas?
body: <p>I have two models each in their own js file within the same directory. One is called Place (for a travel bucket list app) and one is called Country. Country has the URL of an image of its flag as the key flagURL. I want to populate Place's &quot;flag&quot; key with the value of flagURL from Country. What would be the best way to do this?</p>
  <p>Place model</p>
  <pre><code>const mongoose = require('mongoose');
  
  const placeSchema = new mongoose.Schema({
      city: String,
      country: String,
      img: String, // this is for an image of the place, not the flag
      flag: 'flagImg URL Here',
      visited: Boolean,
  });
  
  const Place = mongoose.model('Place', placeSchema);
  
  module.exports = Place;
  </code></pre>
  <p>Country model</p>
  <pre><code>const mongoose = require('mongoose');
  
  const countrySchema = new mongoose.Schema({
      countryName: String,
      countryCode: String,
      flagImg: String
  });
  
  const Country = mongoose.model('Country', countrySchema);
  
  module.exports = Country;
  </code></pre>
  <p>Thanks for the help on my beginner question!</p>