title: Why are db collections created for Mongoose 6 subdocs?
body: <p>I'm looking at upgrading my projects mongoose version from 5.10.19 to latest (6.5.1). I'm noticing that I have a lot more collections in my database than I did before. I made a simple example to test this out and when I run it on mongoose 5, I only see the collection &quot;mains&quot; but mongoose 6 creates &quot;mains&quot; and &quot;subs&quot;. I'd expect that the subdocument models would not have their own collection like mongoose 5 behaves.</p>
  <pre class="lang-js prettyprint-override"><code>import { connect, model, Schema } from 'mongoose';
  
  const mongoUrl = 'mongodb://localhost:27017/test';
  
  (async () =&gt; {
    const subSchema: Schema = new Schema({ color: String, yes: Boolean });
    const mainSchema: Schema = new Schema({ name: String, sub: subSchema });
  
    const MainModel = model('Main', mainSchema);
    model('Sub', subSchema);
  
    await connect(mongoUrl, { ssl: true, sslValidate: false });
    console.log(`Successfully connected to mongodb: &quot;${mongoUrl}&quot;`);
  
    await MainModel.create({ name: 'One', sub: { color: 'Yellow', yes: true } });
  })()
    .then(() =&gt; {
      console.log('\nSuccess');
      process.exit();
    })
    .catch(() =&gt; {
      console.log('\nFailure');
      process.exit();
    });
  </code></pre>
  <p>Is there a mongoose setting I'm missing that's causing this to happen?</p>
  <p>Also, on Node 12.20.12.</p>