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

Inserting a document with a Decimal128 value when featureCompatibilityVersion is 3.2 results in a closed socket

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.9
    • Affects Version/s: 3.4.0
    • Component/s: Write Ops
    • None
    • Fully Compatible
    • ALL
    • Hide

      In C#:

      var document = new BsonDocument { { "_id", 1 }, { "x", new BsonDecimal128(1.1M) } };
      collection.InsertOne(document);
      
      Show
      In C#: var document = new BsonDocument { { "_id" , 1 }, { "x" , new BsonDecimal128(1.1M) } }; collection.InsertOne(document);
    • Platforms 2017-09-11

      When using the C# driver (and presumably other drivers) inserting a document that contains a Decimal128 value when featureCompatibilityVersion is 3.2 results in the socket being closed.

      The following appears in the server logs:

      2016-12-07T11:52:20.797-0500 I -        [conn2] AssertionException handling request, closing client connection: 22 Client Error: bad object in message: Cannot use decimal BSON type when the featureCompatibilityVersion is 3.2. See http://dochub.mongodb.org/core/3.4-feature-compatibility.
      2016-12-07T11:52:20.797-0500 I -        [conn2] end connection 127.0.0.1:53744 (3 connections now open)
      

      I am unable to reproduce this is in the shell, so perhaps this is a result of different code paths in the server (the shell uses OP_COMMAND and drivers do not).

      In the shell I just get a write error but the socket is not closed.

      > db.test.insert({ _id : 1, x : NumberDecimal("1.1") })
      WriteResult({
              "writeError" : {
                      "code" : 22,
                      "errmsg" : "Cannot use decimal BSON type when the featureCompatibilityVersion is 3.2. See http://dochub.mongodb.org/core/3.4-feature-compatibility."
              }
      })
      >
      

            Assignee:
            henrik.edin@mongodb.com Henrik Edin
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: