dmfay / massive-js

A data mapper for Node.js and PostgreSQL.
2.49k stars 158 forks source link

Decomposed results are not ordered correctly #530

Closed nireno closed 6 years ago

nireno commented 6 years ago

massive version: 4.6.3

What I did: I ran a raw query with an "order by date DESC" clause.

//simplified example
const events = await db.query(`
  select evt_id, evt_occurred_at
  from events
  order by evt_occurred_at desc`, [], {
    decompose: {
      pk: 'evt_id',
      columns: ['evt_id', 'evt_occurred_at']
  })

What I expected: The decomposed results should have been ordered in descending order by evt_occurred_at. What actually happened: The decomposed results were ordered in ascending order by evt_id.

dmfay commented 6 years ago

Looks good, I've released 4.6.4. Thanks!