title: MongoDB find the corrupted doc
body: <p>I have a collection of 9 million records where I found an index in which if I tried to get all the documents, it throws the below error.</p>
  
  <pre><code>Error: error: {
  "ok" : 0,
  "errmsg" : "invalid bson type in element with field name '_contract_end_date' in object with unknown _id",
  "code" : 22,
  "codeName" : "InvalidBSON",
  "operationTime" : Timestamp(1585753324, 14),
  "$clusterTime" : {
      "clusterTime" : Timestamp(1585753324, 14),
      "signature" : {
          "hash" : BinData(0,"2fEF+tGQoHsjvCCWph9YhkVajCs="),
          "keyId" : NumberLong("6756221167083716618")
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>So I tried to rename the field to <code>contract_end_date</code> by using <code>$rename</code> operator. When I tried <code>updateMany</code>, it throws the same error.</p>
  
  <p>But <code>updateOne</code> works. But this is not helpful as I just see the success message but not actually updating 100 odd docs for that index. I wonder how to see that corrupted doc to identify the other fields which will help me to identify the application which corrupts.</p>
  
  <p>Sample doc: -It's a pretty simple flatten structure - around 50 fields are there in each doc - no nested docs.</p>
  
  <pre><code>{
   _id:
   sys_contract_end_date:
   customer_name:
   location:
   owner:
   retailer:
   seller:
  }
  </code></pre>