Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-3663

Infinity/-Infinity cannot be used as value of expression in operation/exp editor

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.17.0
    • Component/s: Compass
    • Labels:
      None
    • Environment:
      mac os/Mojave 10.14.5

      Go to editor, for example within Aggregations tab to create new aggregation pipeline.

      Add any valid expression that accepts numeric values as value for expression (some code removed for brevity):

       

       

      // code placeholder
      /**
       * specifications - The fields to
       *   include or exclude.
       */
      {
        _id: 0,
        max_height: {
          $reduce: {
            input: "validfield",
            initialValue: -Infinity,
            in: "validfield
          }
        }
      }
      

      The Compass editor does not allow to use Infinity/-Infinity as valid expression value and outputs:

       

       

      Expected "[" or AggregationStage but "{" found.
      

      The sample code is used on Chapter 3 of MongoDB University aggregation framework course

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            peter.blazejewicz@gmail.com Piotr Blazejewicz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: