title: Remove _id attributes before inserting into database (using node & mongoose)
body: <p>I am using mongodb 3.6.20, mongoose 5.10.9 and node 14.13.1</p>
  <p>The case is the following.
  I want to insert a complex object to db. The object contains an array of objects where each object also contains an array of objects. These objects given by a client which sets the ids(O do not have power over the client to change it). I want to remove the ids and let mongo drivers to handle them and generate new ones.</p>
  <p>what is given:</p>
  <pre><code>let obj = {
    property1: {
      property2: &quot;str&quot;,
      property3: 3
    },
    property4 : [{
      _id: &quot;a valid mongo id&quot;,
      property5: &quot;str&quot;,
      property6: [{
        _id: &quot;another valid mongo id&quot;,
        property7: &quot;str&quot;
      }]
    }]
  }
  </code></pre>
  <p>what I want to provide to insert query:</p>
  <pre><code>let obj = {
    property1: {
      property2: &quot;str&quot;,
      property3: 3
    },
    property4 : [{
      property5: &quot;str&quot;,
      property6: [{
        property7: &quot;str&quot;
      }]
    }]
  }
  </code></pre>
  <p>I have tried to remove them recursively but the call stack is exceeded.
  Is there any clever way I can achieve that? The option <code>{_id: false}</code> and <code>{id:false}</code> that I found on mongoose documentation are actually only for the returned documents of a query</p>