goodybag / mongo-sql

An extensible SQL generation library for JavaScript with a focus on introspectibility
321 stars 72 forks source link

Order by #153

Closed PaulGrimshaw closed 6 years ago

PaulGrimshaw commented 7 years ago

Could i add a pull request allowing more advanced order by syntax? This would be a none breaking change, but allow a more mongo like order by syntax:

order:  {
     "col1": 1 //ascending
     "col2": -1 //descending
}

as well as the existing:

order: [
   "col1", "col2 desc"
]
PaulGrimshaw commented 7 years ago

Ah, realised you can do this:

order: {
      col1: "asc",
      col2: "desc"
}

Have built some tests for it, will submit pull request