Como declarar registro de mongoose ou {[s: string]: objeto}

const productSchema = new Schema({
  title: String,
  amount: Number,
  total: Number,
});

const cartSchema = new Schema({
  total: Number,
  products: {
   	type: Map, // you can change to Array
    of: productSchema,
    default: new Map() // if yout change to Array, default is []
  }
}, { _id: false })

export const Cart = mongoose.model('cart', cartSchema);

/** If you want store an object like this:
  {
  	total: 3000,
    products: {
       'adfs545df': {
       	   amount: 1,
           title: 'Macbook',
           price: 2000
       },
       'dfasd880': {
       	   amount: 2,
           title: 'Iphone',
           price: 500
       }
    }
  }
*/
Thompson Filgueiras