title: How to create a mongoose sub model without creating a collection for it
body: <pre><code>const walletTransactionSchema = new mongoose.Schema({
          a: {type: Boolean, required: true},   
      },
      {timestamps: {createdAt: 'created_at', updatedAt: 'updated_at'}});
  
  const walletSchema = new Schema({
      b: {type: Boolean, required: true},       
      transactions: [{type: walletTransactionSchema}],
  });
  
  walletSchema.index({'transactions': 1}, {sparse: true});   
  
  
  module.exports.Wallet = mongoose.model('Wallet', walletSchema, 'wallets');
  module.exports.WalletTransaction = mongoose.model('WalletTransaction', walletTransactionSchema);
  </code></pre>
  <p>I'm trying to create a model for a subdocument (WalletTransaction) without creating a collection for it. Unfortunately mongoose is automatically creating that collection. How can I prevent that behavior and just define a sub-model without creating a collection. I prefer to organize my schemas by refactoring them instead of just embedding them.
  I used to do this without trouble with above definitions. I guess after updating to mongoose 6.0.8 (from 5.13) this is happend.</p>