课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Using an API endpoint to update data
课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
Using an API endpoint to update data
- [Instructor] We have a new post endpoint which needs to persist a new name to the list of names on a contest. The code needed here is similar to the code we have in the get single contest information endpoint. So it will have to connect to a client and it will have to await on the client doing some operation on the contest collection. The operation though is not find one because we need to update the contest. So here's the syntax that we need, findOneAndUpdate, and it takes multiple arguments in this case. The first argument is the same one. It's what MongoDB is going to use to find the document, and that's exactly what we need, we're passing the contest ID in the pram. And then the second argument is a list of operations to do on that document. So you can update a field, remove the field, add a field, add a sub document or what we need in this case, push an item into a field that is an array. We need to take the…
内容
-
-
-
-
-
-
-
(已锁定)
Handling data in an array3 分钟 27 秒
-
(已锁定)
Reading form data with the DOM API6 分钟 49 秒
-
(已锁定)
Understanding HTTP request methods2 分钟 19 秒
-
(已锁定)
Using an API endpoint to update data9 分钟 48 秒
-
(已锁定)
Updating UI based on API response1 分钟
-
(已锁定)
Project challenge2 分钟 1 秒
-
(已锁定)
Next steps1 分钟 27 秒
-
(已锁定)