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

Comment on: "manual/reference/operator/aggregation/map.txt"

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None

    Description

      NB, Correction for https://jira.mongodb.org/browse/DOCS-7367

      I think the $add below should be a $mul.

      db.sales.aggregate( [
      {
      $project: {
      finalTotal: {
      $let: {
      vars: {
      total:

      { $add: [ '$price', '$tax' ] }

      ,
      discounted: { $cond:

      { if: '$applyDiscount', then: 0.9, else: 1 }

      }
      },
      in:

      { $multiply: [ "$$total", "$$discounted" ] }

      }
      }
      }
      }
      ] )

      Attachments

        Activity

          People

            steve.renaker@mongodb.com Steve Renaker (Inactive)
            banksysan David Banks
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              7 years, 45 weeks, 6 days ago