Querying Our Movies with the Query Builder

In this lesson, we'll introduce both the database and model query builder. We'll learn the differences between the two and the basics of how to use them.

Published
Mar 05, 24
Duration
15m 30s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

Get the Code

Download or explore the source code for this lesson on GitHub

Repository

Join The Discussion! (2 Comments)

Please sign in or sign up for free to join in on the dicussion.

  1. Commented 16 days ago

    Hi! I noticed that in your tutorial, you're able to directly use the movie objects returned from queries, but in my Adonis.js v6 project, I had to use .toObject() to handle the Lucid ORM proxy objects. Is this because the tutorial was written for an earlier version of Adonis? Could you clarify this difference in behavior between versions?

    1

    Please sign in or sign up for free to reply

    1. Commented 12 days ago

      Hi cortesbr! You shouldn't need to call toObject() to access the model's properties; you should be able to directly reference them via movie.id, for example. Please make sure you're using at least NodeJS v20. If you are using NodeJS v20 or later, please feel free to share your repository and I can see if anything stands out.

      0

      Please sign in or sign up for free to reply