Learn how to create, update, and delete in the API.
- [Instructor] Now that we've created…the routes for reading the data,…it's time to add write functionality to the system.…We'll need to add create, update, and delete…to make the system fully functional.…As before, there are stubs in the code for the routes,…so we just need to add the Mongo functionality.…We'll start with create,…a post to the tours list to create a new item.…These tours are pretty complicated,…but we don't actually need to have all of the fields.…We'll check the post body from the request…and create the object from that.…First, the code.…
We're going to use the collection,…and insert one,…and in this case it's request dot payload…For the form parameters.…And we have a function, error, result.…Reply, request payload.…Just to make sure that we got it.…So the request dot payload is going to contain…all of the fields and values sent by the client,…and we're just going to pass that along, whole cloth,…to the insert one function.…
So start up the server again.…And let's use HTTPie.…Remember that with a browser, you can't actually do a post,…
- Installing MongoDB for Windows and OS X
- Why Mongo?
- Document-oriented data
- Exploring the Mongo shell
- Importing data into the database
- Building an application in Node.js
- Tuning Mongo queries
- Replication and sharding
Skill Level Intermediate
1. Understand MongoDB
2. Explore the System
3. Build an Application in Node
Node MongoDB setup4m 59s
4. Advanced Topics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.