This can be done through the query builder using .select, however I am unsure if this is possible using lucid model.
Thanks in advance.
Have you tried writing the code using a Lucid model?
I did try however there is no method in lucid model (as far as I have seen in the documentation) to show only specific columns in the query similar to a SQL SELECT statement. My options are use query builder or use javascript and loop on the returned object from lucid model method and obtain only the columns I want, although I think the query build approach would be faster. It would be better however if I can do this throught the lucid model.
Mentioned in the docs http://adonisjs.com/docs/4.0/lucid#_query_builder
The query method on any model returns an instance of query builder and hence you are use any method of the query builder here.
await User.query().select().fetch()
Oh, my bad!
Thank you :smile:
Most helpful comment
Mentioned in the docs http://adonisjs.com/docs/4.0/lucid#_query_builder
The
querymethod on any model returns an instance of query builder and hence you are use any method of the query builder here.