Skip to content

Ordering with default value doesn't work #53

@vmx

Description

@vmx

According to the query language reference, it's possible to have a default value for the ordering, if the field it is ordered on isn't defined.

Here's an example:

drop target/tests/querytestorder;
create target/tests/querytestorder;

add {"_id":"9", "bar": true};
"9"
add {"_id":"10", "bar": false};
"10"
add {"_id":"15", "foo":"coll", "bar": "string"};
"15"
add {"_id":"18"};
"18"

# This one is OK
find {}
order .bar asc
return .bar;
[
null,
false,
true,
"string"
]

# This one is also OK
find {}
order .bar default=1 asc
return .bar default=1;
[
false,
true,
1,
"string"
]

# This one fails. It returns `null` as first element.
# If it would take the `default=1` into account,
# it would have the order shown below.
find {}
order .bar default=1 asc
return .bar;
[
false,
true,
null,
"string"
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions