title: How to select two table (document) value at a time by user id in mongoose?
body: <p>I am using NodeJs, ExpressJs with Mongodb and Mongoose. I want to select two document's value by user id.</p>
  
  <p>I have three model User, Academic and Career. I have made a relation with Academic and Career schema by _id of User schema. I have saved some values in these documents. Now i want to select academic and career's document value by user id.</p>
  
  <h1>Model</h1>
  
  <pre><code> // user model
      const userSchema = new mongoose.Schema({
          name: {type: String},
          email: {type: String},
      });
      const user = mongoose.model('User', userSchema);
  
      // academic model
      const academicSchema = new mongoose.Schema({
          academicLevel: {type: String},
          passYear: {type: Number},
          user: {
              type: mongoose.Schema.Types.ObjectId,
              ref: 'User'
          }
      });
      const academic = mongoose.model('Academic', academicSchema);
  
      // career model
      const careerSchema = new mongoose.Schema({
          jobTitle: {type: String},
          company: {type: String},
          user: {
              type: mongoose.Schema.Types.ObjectId,
              ref: 'User'
          }
      });
      const career = mongoose.model('Career', careerSchema);
  </code></pre>
  
  <h1>documents</h1>
  
  <pre><code>// user documents
  
  _id: objectId("5d0df6a4134d4d295ca9f212")
  name: "John Doe"
  email: "john@gmail.com"
  
  _id: objectId("5d0e70a6c87ca528c0a79a0f")
  name: "Mark Boucher"
  email: "mark@gmail.com"
  
  
  // academic documents
  
  _id: objectId("5d60bc7188a8ef3648b8e8cf")
  academicLevel: "Master"
  passYear: "2018"
  user: objectId("5d0e70a6c87ca528c0a79a0f")
  
  _id: objectId("5d60d56f0cf9af32901cb2aa")
  academicLevel: "Bachelor"
  passYear: "2016"
  user: objectId("5d0e70a6c87ca528c0a79a0f")
  
  // career documents
  
  _id: objectId("5d60bc1d88a8ef3648b8e8ce")
  jobTitle: "Software Engineer"
  company: "Daffodil Software Ltd."
  user: objectId("5d0e70a6c87ca528c0a79a0f")
  </code></pre>
  
  <h1>nodejs</h1>
  
  <pre><code>router.get('/getInfoById', async (req, res) =&gt; {
      const user = await User
      .find(req.query.id)
      .select()
  
      res.send(user);
  })
  </code></pre>
  
  <p>How to get values from two documents (academic and career) by user id. Thanks.</p>