吸引力模型已经创建,我只是尝试在添加新设施后向其中添加设施ID。设施成功向其添加吸引力ID,但吸引力似乎并未更新以添加设施ID 。下面的代码是创建新设施的地方。
const facility = new Facility({ paidWifi, freeWifi , cashMachines ,lockers , disabledToilets , electricCarParking ,attraction:attractionId });
facility.save(function (err) {
if (err) return handleError(err);
// thats it!
});
const attraction = Attraction.findOneByIdAndUpdate(attractionId, { facility });
console.log(attraction);
return facility;