Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order in select query #148

Open
bakhodir10 opened this issue May 3, 2017 · 1 comment
Open

order in select query #148

bakhodir10 opened this issue May 3, 2017 · 1 comment

Comments

@bakhodir10
Copy link

bakhodir10 commented May 3, 2017

https://github.com/goodybag/mongo-sql/blob/master/docs/query-helpers.md#helper-order

Here is documentation and there is written
// select "users".* from "users" order by "order"."id" desc, "order"."name" asc
{
type: 'select'
, table: 'users'

// Object syntax is the preferable way since it can automatically
// quote your columns and add in the default table
, order: { id: 'desc', name: 'asc' }
, order: ['id desc', 'name asc']
, order: 'id desc'
}
but when I use
order: { id: 'desc', name: 'asc' }
it shows the error that
"{ error: syntax error at or near "order".
Then I tested
orderBy: { id: 'desc', name: 'asc' } and it is working correctly.

@bakhodir10 bakhodir10 changed the title there is issue on the ordering order in select query May 3, 2017
@CvBlixen
Copy link
Collaborator

Maybe I'm misunderstanding the question @bakhodir10, but when i try

{
  type: 'select',
  table: 'users',
  order: { id: 'desc', name: 'asc' }
}

on the playground it results in

select "users".* from "users" order by "users"."id" desc, "users"."name" asc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants