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

$mul example seems to advocate using floating point for currency

    XMLWordPrintableJSON

Details

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

    Description

      See http://docs.mongodb.org/manual/reference/operator/update/mul/#multiply-the-value-of-a-field

      The example uses a document with the structure:

      { _id: 1, item: "ABC", price: 10.99 }

      While the result of the $mul operator results in an obviously incorrect price value, we don't explain why it might not be a good idea to use floating point as a representation of price. Perhaps the message is too subtle?

      See http://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            graham.lowe@mongodb.com Graham Lowe (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              5 years, 47 weeks, 5 days ago