title: Find a document by an object id in that doc in mongoDB node js express js
body: <p>Hey  this i want to fetch the products of a certain user so i added the user in the model by Object id , but when i was setting the router callBack function i didn't know how to do it !</p>
  <pre><code>{
      &quot;_id&quot;: {
          &quot;$oid&quot;: &quot;62f250d3e2533cf4ca2ad7f3&quot;
      },
      &quot;image&quot;: &quot;https://eshop-server.herokuapp.com/public/uploads/Surface-Pro-7-128GB-1604665289664.png&quot;,
      &quot;brand&quot;: &quot;ASUS&quot;,
      &quot;price&quot;: {
          &quot;$numberInt&quot;: &quot;250&quot;
      },
      &quot;rating&quot;: null,
      &quot;numReviews&quot;: null,
      &quot;isFeatured&quot;: false,
      &quot;name&quot;: &quot;Surface Pro 7 128GB&quot;,
      &quot;description&quot;: &quot;Tablet PC - Intel Core i3 1005G1 Ice Lake, touchscreen 12.3\&quot; IPS 2736 × 1824, RAM 4GB LPDDR4X, Intel UHD Graphics&quot;,
      &quot;category&quot;: {
          &quot;$oid&quot;: &quot;5f15d54cf3a046427a1c26e3&quot;
      },
      &quot;user&quot;: {
          &quot;$oid&quot;: &quot;62f0e99be78e33cc5662d1f4&quot;
      },
      &quot;reviews&quot;: [{
          &quot;avatar&quot;: &quot;https://pbs.twimg.com/profile_images/1760228143/Vetor-Johnny-Bravo-Vetorizado-Corel_400x400.jpg&quot;,
          &quot;name&quot;: &quot;Johnny Bravo&quot;,
          &quot;review&quot;: &quot;Amazing experience all around&quot;
      }, {
          &quot;avatar&quot;: &quot;https://vignette.wikia.nocookie.net/asterix/images/3/3c/Asterix.png&quot;,
          &quot;name&quot;: &quot;Asterix&quot;,
          &quot;review&quot;: &quot;It's very hard. Only managed with resource to magic potion&quot;
      }, {
          &quot;avatar&quot;: &quot;https://vignette.wikia.nocookie.net/looneytunes/images/7/7f/Coyote.gif&quot;,
          &quot;name&quot;: &quot;Wild Coyote&quot;,
          &quot;review&quot;: &quot;All my trickery and tools paid of. Thank ACME for suggesting this product to me&quot;
      }],
      &quot;countInStock&quot;: {
          &quot;$numberInt&quot;: &quot;8&quot;
      },
      &quot;__v&quot;: {
          &quot;$numberInt&quot;: &quot;0&quot;
      },
      &quot;richDescription&quot;: &quot;eatures a detachable keyboard and offers the comfort of a classic laptop as well as the convenience of a tablet.&amp;nbsp&quot;,
      &quot;images&quot;: [&quot;http://localhost:3000/public/uploads/5f15d8852a025143f9593a7c-1604665316399.png&quot;, &quot;http://localhost:3000/public/uploads/5f15d8852a025143f9593a7c-1604665316400.jpeg&quot;]
  }
  </code></pre>
  <p>as You can see the user object id is included so how can i find it ! this i what i tried but it didn't work</p>
  <pre><code>router.get(`/:id/products`, async (req, res) =&gt; {
    const productList= await Product.find({user.$oid:req.params.id}).populate(&quot;user&quot;);
  
    if (!productList) {
      res.status(500).json({ success: false });
    }
    res.send(productList);
  });
  </code></pre>