Want to have access to everything?

Go PRO to have access to this lesson and the entire Adonis Mastery library. Already a PRO? Sign in to continue learning!

Retrieving A Single Record

In this lesson, we cover how to retrieve a single record from the database. We look at two ways of achieving that.

Introduction to Lucid

46mins
13 lessons
Beginner

Getting Started

1m 19s

We start of the course by looking at what Lucid is.

2m 29s

Lucid isn't installed out of the box in a fresh AdonisJS 5 application. So before we can start making use of it, we need to first install and set it up.

In this lesson, we look at what a Lucid model is and how to create one.

Lucid employs a convention over configuration approach. In this lesson, we go over some of the conventions and how to override them.

Though models are not tied to migrations, in this lesson, we cover how to create database tables using migrations.

Unlike in AdonisJS 4, we now need to define database table columns inside models. In this lesson, we cover how to define database table columns on models.

CRUD

Let's start performing some actual database operations. In this lesson, we cover inserting records into the database.

In this last lesson, we saw how to insert records into the database. Instead of having to go into the database to see created records, it will be nice if we can retrieve and display all the created posts directly in our application. Let's see how we can achieve that.

In this lesson, we cover how to retrieve a single record from the database. We look at two ways of achieving that.

In this lesson, we look at how Lucid implicitly handles when a record doesn't exist in the database.

In addition to the Lucid ORM, AdonisJS also has a query builder, which can be used with models. In this lesson, we look at how to make use of the query builder to perform complex database queries.

So far we have seen how to insert records in the database, retrieve records from the database. Now, let's see how to update a record in the database.

To complete the CRUD section, let's see how to delete record from the database.

Chimezie Enyinnaya

Hi, I'm Chimezie Enyinnaya, your teacher.

I’m a self-taught software developer based in Lagos, Nigeria, with over 8 years of experience. In the last couple of years, I've been doing more teaching because I enjoy sharing my knowledge so that others can benefit from it. Come along as I teach you all I know about AdonisJS, Node.js, and JavaScript at large!

Lesson video (SD)
Lesson video (HD)

No comments yet.