Skip to content

Queries with $expr are not fully implemented #15

@tlhunter

Description

@tlhunter

Consider the following query:

{
    $expr: {
       $lt:[ {
          $cond: {
             if: { $gte: ["$qty", 100] },
             then: { $divide: ["$price", 2] },
             else: { $divide: ["$price", 4] }
           }
       },
       5 ]
  }
}

The expected result would contain fields for price and qty. Instead the results for for a field named $expr:

RESULT {
  "parts": [
    {
      "field": "$expr",
      "operator": "$lt",
      "operand": [
        {
          "$cond": {
            "if": {
              "$gte": [
                "$qty",
                100
              ]
            },
            "then": {
              "$divide": [
                "$price",
                2
              ]
            },
            "else": {
              "$divide": [
                "$price",
                4
              ]
            }
          }
        },
        5
      ],
      "parts": []
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions