title: MongoDB -How to get last 30 days date from given date and that last 30 days date should be current date?
body: <p>I am the beginner of MongoDB </p>
  
  <p>Here I mentioned below my one document</p>
  
  <pre><code>{
  "_id" : ObjectId("5e5bc292361b710c7727718e"),
  "branch_id" : "BR5cc825dac42dac3aae49ff91",
  "inventory" : [ 
      {
          "inventory_stock_id" : "wewe123",
          "stock_name" : "xxxxx",
          "stock_point" : "27",
          "stock_type" : "yyyy",
          "batch" : [ 
              {
                  "quantity" : 40,
                  "manf_date" : "10-01-2020",
                  "exp_date" : "01-04-2020"
              }
          ]
      }
  ]
  }
  </code></pre>
  
  <p>I want to get last 30 days from <strong>"exp_date"</strong> but it should be <strong>equal</strong> to <strong>current date</strong></p>
  
  <p>Here I mentioned <strong>exp_date: "01-04-2020"</strong> and the past 30 days of date is today date( <strong>"02-03-2020"</strong>)</p>
  
  <pre><code>db.collection.find({"inventory.batch.exp_date" : {"$lte":"01-04-2020","$eq":"02-03-2020"}})
  </code></pre>
  
  <p>I don't know how to get last 30 days of <strong>exp_date</strong> and equal to current date</p>
  
  <p>so anyone help me to solve this issue.</p>