title: the id of cart shows null in controller but i m sure i m sending it NODE JS
body: <p>I m sending the id of the product from this view (I m using express and mongoose db)</p>
  <pre><code>    &lt;form action=&quot;/cart&quot; method=&quot;POST&quot;&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;&lt;%= product._id %&gt;&quot; /&gt;
        &lt;button class=&quot;btn&quot; type=&quot;submit&quot;&gt;Add to Cart&lt;/button&gt;
  </code></pre>
  <p>I m sure it is not null here</p>
  <p>then I have this middleware to receive it</p>
  <pre><code>router.post(&quot;/cart&quot;, shopController.postCart);
  </code></pre>
  <p>and here is the function post Cart</p>
  <pre><code>exports.postCart = (req, res, next) =&gt; {
    const prodId = req.params.id;
    console.log(&quot;id returned from the params : &quot; + prodId);
    Product.findById(prodId)
      .then((product) =&gt; {
        console.log(product);
        return req.user.addToCart(product);
      })
  </code></pre>
  <p>When I first receive it in the postcard function I made a log and it gives me the log console</p>
  <pre><code>id returned from the params: undefined
  null
  </code></pre>
  <p>I tried wrapping the id with ObjectId of mongoose then it shows me this message</p>
  <pre><code>exports.postCart = (req, res, next) =&gt; {
    const prodId = req.params.id;
    console.log(&quot;id returned from the params : &quot; + ObjectId(prodId));
    Product.findById(ObjectId(prodId))
      .then((product) =&gt; {
        console.log(product);
        return req.user.addToCart(product);
      })
  </code></pre>
  <p>error :</p>
  <pre><code>id returned from the params : 62c9a1ca3b17ea86134d12fc
  null
  </code></pre>
  <p>product:
  in database :</p>
  <pre><code>{  &quot;_id&quot;: {    &quot;$oid&quot;: &quot;62c87c728594df06fd459521&quot;  },  &quot;title&quot;: &quot;,gh,&quot;,  &quot;price&quot;: 44,  &quot;description&quot;: &quot;nfggfngh &quot;,  &quot;imageUrl&quot;: &quot;https://media.gettyimages.com/photos/stack-of-books-picture-id157482029?s=612x612&quot;,  &quot;userId&quot;: {    &quot;$oid&quot;: &quot;62c71d0ab0312958a8082d6f&quot;  },  &quot;__v&quot;: 0}
  </code></pre>