Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-23972

NumberDecimal values can be inserted in legacy write mode when featureCompatibilityVersion is 3.2

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.14
    • Affects Version/s: 3.3.5
    • Component/s: Write Ops
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Query 2016-09-19
    • 0

      When featureCompatibilityVersion is 3.2, it should be an error to insert documents containing NumberDecimal values in legacy write mode.

      Previous description:
      Documents that contain NumberDecimal values can be inserted in legacy write mode. The same documents cannot be inserted when using write command mode.

      var coll = db.foo;
      coll.drop();
      
      // The write fails when using write commands:
      // "Attempt to use a decimal BSON type when support is not currently enabled."
      assert.writeError(coll.insert({a: NumberDecimal(2.0)}));
      assert.eq(coll.count(), 0);
      
      // The write succeeds when using legacy writes.
      db.getMongo().forceWriteMode('legacy');
      coll.insert({a: NumberDecimal(2.0)});
      
      // This assertion fails because there's a document present.
      assert.eq(coll.count(), 0);
      

            Assignee:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: