Query Raw Builder Adonis v5

Good day everyone any idea how to work this raw function?
Capture

2 Likes

As per documentation Adonis JS 5 Preview

Database.rawQuery('select * from users;')

But when im using that im getting this error .
image

1 Like

what is your node and npm versions. for v5 node version 12 is required

1 Like

Is this whole error or is there some more context to it?

I think this function is not working from adonis v5 for using sub query

Really hard to say without any context. This is working just fine:

import Route from '@ioc:Adonis/Core/Route'
import User from 'App/Models/User'

Route.get('/test', async () => {
  return User.query()
    .with('cars', (builder) => {
      builder.whereRaw('something LIKE that')
    })
})
3 Likes

Thanks it’s working .