The attraction model is already created, I am just trying to add the facility Id to it after a new facility is added.The facility successfully adds the attraction Id to it but the attraction does not seem to update to add the facility id. Code below is where the new facility is created.
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;