I got this working and it seems like it does everything it is supposed to. response.json looks the same as the example and the array is being saved in my mongodb atlas. Why is this not passing the test
let responseObject = {};
responseObject["_id"] = req.body.userId;
User.findById(req.body.userId, (err,data) => {
if(err) return console.log(err);
responseObject["username"] = data.username;
console.log(req.body.date);
let dateString = "";
if(req.body.date === ""){
dateString = new Date().toString();
}else{
dateString = new Date(req.body.date).toString();
}
dateString = dateString.split(' ').slice(0,4).join(' ');
responseObject["date"] = dateString;
responseObject["duration"] = req.body.duration;
responseObject["description"] = req.body.description;
data.log.push({description: req.body.description, duration: req.body.duration, date: responseObject.date.toString()});
data.save();
res.json(responseObject);
})
})```