const mongoose = require('mongoose'); const {Schema} =mongoose; const itemSchema = new Schema({ detalle:{type:String}, valor:{type:Number}, tipo:{type:String, required:true} }) const AhorroSchema=new Schema({ date: {type: Date, default: Date.now}, nombreAhorro: {type:String,required:true}, detalleAhorro:{type:String,required:true}, datos:[itemSchema], user:{type:String, required:true}, child:itemSchema }); module.exports.Ahorro=mongoose.model('ahorro',AhorroSchema); module.exports.itemAhorro=mongoose.model('itemAhorro',itemSchema);