为什么超出了最大调用堆栈大小?

时间:2019-04-23 08:07:47

标签: node.js mongodb mongoose

当我尝试将预订添加到商品的预订数组中时,它可以正常工作,但发生了此错误-RangeError:仅当商品的预订数组为空时,最大调用堆栈大小超出了

// create method impl
let booking = null;      

switch (place.category.name) {
  case 'hotel':
    booking = new HotelBooking(bookingDetails);
    break;
  case 'restaurant':
    booking = new RestaurantBooking(bookingDetails);
    break;
}

const newBooking = await booking.save();

// Add booking to offer's bookings array
offer.bookings.push(newBooking); //error here
await offer.save();

const bookingsSchema = new Schema({
}, {discriminatorKey: 'kind'});

const Booking = mongoose.model('bookings', bookingsSchema);

hotel booking model  offer mode l

0 个答案:

没有答案