Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-12936

Investigate changes in SERVER-34373: create an expression to test if expression type is numerical

    XMLWordPrintableJSON

Details

    Description

      Description

      SERVER ticket description:

      Currently to determine if type of expression is a number you have to do this:

      {$in:[ {$type:"$expression"}, ["int", "long", "double", "decimal"] ]}
      

      It would be nice to have shorthand syntax for this test. Maybe $isNumeric or $isNumber?

      Note that query/matcher already supports {a:{$type:"number"}} but not agg.

      Change Description:

      A new expression, $isNumber, was added to the aggregation expression language. It takes a single expression as an unnamed argument; the format is: {$isNumber: <expression>}. It returns true if the expression evaluates to an int, double, decimal, or long, and false otherwise.

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

      Attachments

        Activity

          People

            ravind.kumar Ravind Kumar (Inactive)
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              4 years, 2 weeks, 2 days ago