title: Mongodb updateMany() not working in nodejs
body: <p>I have a collection called imported_products with documents as following,</p>
  <pre><code>{
      &quot;_id&quot; : ObjectId(&quot;61dd75ab9c56561c4e36ae64&quot;),
      &quot;shop&quot; : &quot;lotesting.myshopify.com&quot;,
      &quot;shopUserData&quot; : {
          &quot;name&quot; : &quot;LoTesting&quot;,
          &quot;email&quot; : &quot;test@gamil.com&quot;
      },
      &quot;productData&quot; : {
          &quot;title&quot; : &quot;Fiodio Rainbow Membrane Gaming Keyboard, Quiet Wired Computer Keyboard, 104 Silent Keys, 26 Anti-Ghosting Keys, Spill Resistant, Multimedia Control for PC and Desktop&quot;,
          &quot;description&quot; : &quot;Easy Operation &amp; Broad Compatibility: As a plug-and-play device, this USB wired gaming keyboard does not need any software support, serving as a great choice for PC, laptop, computer keyboard. It is compatible with Win XP / Win7 / Win8 / Win10.&quot;,
          &quot;price&quot; : 30.74,
          &quot;priceWithCurrency&quot; : &quot;$30.74&quot;,
          &quot;images&quot; : [
              &quot;https://m.media-amazon.com/images/I/51YO1+k0bIL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/510vNeFx5QL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51XA0CmhmEL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/41Ywwi-KgiL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51lq5qZLJdL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51Nwf+EAaDL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/41tljLXU40L._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51nVhirK6ML._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51xMxfShNGL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/519oWM+mnzL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51YO1+k0bIL._SL500_.jpg&quot;
          ],
          &quot;ASIN&quot; : &quot;B086168Y25&quot;,
          &quot;marketPlace&quot; : &quot;www.amazon.com&quot;,
          &quot;settings&quot; : {
              sendNotification: true
          },
          &quot;shopifyProductId&quot; : 6755890495624,
          &quot;productUrl&quot; : &quot;https://www.amazon.com/FIODIO-Comfortable-Anti-Ghosting-Resistant-Multimedia/dp/B086168Y25/ref=sr_1_1_sspa?keywords=gaming+keyboard&amp;pd_rd_r=9a66bdd8-f451-45a7-931f-999bb794436d&amp;pd_rd_w=EDbsr&amp;pd_rd_wg=HKpTZ&amp;pf_rd_p=12129333-2117-4490-9c17-6d31baf0582a&amp;pf_rd_r=TTMA6EPTSPTT6ZVVMC2Q&amp;qid=1641903304&amp;sr=8-1-spons&amp;psc=1&amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEyNEtSUTlGSDZOSEwzJmVuY3J5cHRlZElkPUEwNDE3NDI3MkROTkM4QTFOUE44VyZlbmNyeXB0ZWRBZElkPUEwMzQyOTQ4MVNYODZWTFgzN1RMUSZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU=&quot;
      },
      &quot;created_at&quot; : ISODate(&quot;2022-01-11T12:18:51.260Z&quot;)
  }
  {
      &quot;_id&quot; : ObjectId(&quot;61dd75bf9c56561c4e36ae65&quot;),
      &quot;shop&quot; : &quot;lotesting.myshopify.com&quot;,
      &quot;shopUserData&quot; : {
          &quot;name&quot; : &quot;LoTesting&quot;,
          &quot;email&quot; : &quot;test@gmail.com&quot;
      },
      &quot;productData&quot; : {
          &quot;title&quot; : &quot;Fiodio Rainbow Membrane Gaming Keyboard, Quiet Wired Computer Keyboard, 104 Silent Keys, 26 Anti-Ghosting Keys, Spill Resistant, Multimedia Control for PC and Desktop&quot;,
          &quot;description&quot; : &quot;Easy Operation &amp; Broad Compatibility: As a plug-and-play device, this USB wired gaming keyboard does not need any software support, serving as a great choice for PC, laptop, computer keyboard. It is compatible with Win XP / Win7 / Win8 / Win10.&quot;,
          &quot;price&quot; : 30.74,
          &quot;priceWithCurrency&quot; : &quot;$30.74&quot;,
          &quot;images&quot; : [
              &quot;https://m.media-amazon.com/images/I/51YO1+k0bIL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/510vNeFx5QL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51XA0CmhmEL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/41Ywwi-KgiL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51lq5qZLJdL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51Nwf+EAaDL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/41tljLXU40L._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51nVhirK6ML._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51xMxfShNGL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/519oWM+mnzL._SL500_.jpg&quot;,
              &quot;https://m.media-amazon.com/images/I/51YO1+k0bIL._SL500_.jpg&quot;
          ],
          &quot;ASIN&quot; : &quot;B086168Y25&quot;,
          &quot;marketPlace&quot; : &quot;www.amazon.com&quot;,
          &quot;settings&quot; : {
              sendNotification: true
          },
          &quot;shopifyProductId&quot; : 6755890692232,
          &quot;productUrl&quot; : &quot;https://www.amazon.com/FIODIO-Comfortable-Anti-Ghosting-Resistant-Multimedia/dp/B086168Y25/ref=sr_1_1_sspa?keywords=gaming+keyboard&amp;pd_rd_r=9a66bdd8-f451-45a7-931f-999bb794436d&amp;pd_rd_w=EDbsr&amp;pd_rd_wg=HKpTZ&amp;pf_rd_p=12129333-2117-4490-9c17-6d31baf0582a&amp;pf_rd_r=TTMA6EPTSPTT6ZVVMC2Q&amp;qid=1641903304&amp;sr=8-1-spons&amp;psc=1&amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEyNEtSUTlGSDZOSEwzJmVuY3J5cHRlZElkPUEwNDE3NDI3MkROTkM4QTFOUE44VyZlbmNyeXB0ZWRBZElkPUEwMzQyOTQ4MVNYODZWTFgzN1RMUSZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU=&quot;
      },
      &quot;created_at&quot; : ISODate(&quot;2022-01-11T12:19:11.391Z&quot;)
  }
  
  </code></pre>
  <p>I am trying to update all of documents for a certain category under a collection in my mongodb. But, i cannot update. When i try the same query in mongodb shell, it works.</p>
  <p>What i want to do is that, for a specific shop i want to update the settings object that is a nested object of producdData object in every document and for all documents that include that shop, in this case, &quot;lotesting.myshopify.com&quot;. I want to update or create that settings object with certain key, value pairs.</p>
  <p>I tried the follwoing.</p>
  <pre><code>export const updateProductsSettings = async (db, shop, settingsObj) =&gt; {
    try {
      await db.collection('imported_procucts').updateMany(
        { shop },
        {
          $set: {
            'productData.settings.automaticPriceChange':
              settingsObj.automaticPriceChange,
            'productData.settings.priceChangePercentage':
              settingsObj.priceChangePercentage,
          },
        }
      );
    } catch (err) {
      throw new Api500Error(err);
    }
  };
  </code></pre>
  <p>The same query works on mongodb shell but in node.js, it cannot even match the shop. I checked, the shop that i am passing is correct but, the match count is 0 for the shop. It does not update anything but, it also does not give any error.</p>