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

ValueWriter cannot serialize objects that have properties with type Symbol

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Won't Fix
    • None
    • None
    • None
    • Query Execution
    • ALL

    Description

      MongoDB Enterprise > db.symbol.insert({_id: 1, sym: Symbol("foo")})
      Error: unable to convert JavaScript property to mongo element sym :
      addToOperationsList@src/mongo/shell/bulk_api.js:606:28
      Bulk/this.insert@src/mongo/shell/bulk_api.js:649:20
      DBCollection.prototype.insert@src/mongo/shell/collection.js:317:9
      @(shell):1:1
      

      The shell wants to use ValueWriter to convert the JSON document (with its Symbol property) to BSON, but ValueWriter is missing a case for the Symbol object, which should be translated to a BSONType::Symbol.

      https://github.com/mongodb/mongo/blob/581c58c475a872e25b2e3bf7cf5ccd52425ef7c7/src/mongo/scripting/mozjs/valuewriter.cpp#L248-L278

      Attachments

        Issue Links

          Activity

            People

              projjal.chanda@mongodb.com Projjal Chanda
              justin.seyster@mongodb.com Justin Seyster
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: