Вы можете сделать это так:
const mongoose = require("mongoose");
const OrderDetails = mongoose.Schema(
{
fitoName: String,
fitoCode: String,
providerName: String,
providerCode: String,
quantity: Number,
storUrl: String
},
{ _id: false } // If you don't want an ID to be created by MongoDB
);
const Orders = mongoose.model(
"orders",
new mongoose.Schema(
{
orderDetail: {
type: [OrderDetails],
required: true
}
},
{ timestamps: true }
)
);