Skip to content

current sorting on multiple values is broken by design #12

@postsql

Description

@postsql

the test says:

it('should sort records using multiple sort criteria, with first name asc', function(done) {
User.find({ where: { type: 'sort test multi' }, sort: { last_name: 1, first_name: 1 } }

but as there is no defined order for object fields (hash/dictionary keys), then you can not meaningfully specify multi-key sort order using dictionaries. It has to be an Array, so the test (and implementations) should do:

User.find({ where: { type: 'sort test multi' }, sort: [{ last_name: 1}, {first_name: 1 }] }

to guarantee that result is sorted on last_name first and then on first_name

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions