Check out a free preview of the full Digging Into Node.js course:
The "Insert into Database Exercise" Lesson is part of the full, Digging Into Node.js course featured in this preview video. Here's what you'd learn in this lesson:

Kyle instructs students to write an asynchronous function to insert an item into the database.

Get Unlimited Access Now

Transcript from the "Insert into Database Exercise" Lesson

[00:00:00]
>> Kyle Simpson: I'm gonna have you try your hand at implementing the insertSomething function. We'll take just a couple of minutes to let you try your hand at implementing insertSomething. And it's gonna look an awful lot like the insertOrLookupOther, except a little bit more straightforward, cuz it only used to do the last part instead of both parts.

[00:00:19] But go ahead and write and async function called insertSomething, it's got to take the other ID in the something, it's got to insert them into the something table, and then return a true if it was successful, otherwise, return something false, if it wasn't. We'll take a couple of minutes and then we'll come back and talk about the insertSomething function.