(脑子一时锈掉了)后端操作要提取出博客的author、url、likes等信息,如果我只包含likes的话,其他的值就是会是undefined,这些undefined将会作为值取更新对应的字段,所以要将其他的也一并包含。 blogRouter.put("/:id", async (request, response) => { const body = request.body; const blog = { title: body.title, author: body.author, url: body.url, likes: body.likes, }; const updateBlog = await Blog.findByIdAndUpdate(request.params.id, blog, { new: true, runValidators: true, }).populate("user", { username: 1, name: 1 }); if (updateBlog) { response.send(updateBlog); } else { response.status(404).end(); } });