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

Add support for ES6 symbol type to shell and server-side JS

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.1.6
    • Component/s: JavaScript, Shell
    • Query Execution
    • Dev Tools 2019-11-04

      ES6 adds support for a symbol type. This type is not supported in our shell and server-side JS, even though SpiderMonkey provides native support:

      // Shell
      > db.foo.insert({a: Symbol()});
      2015-07-22T15:17:17.176-0400 E QUERY    [thread1] Error: unable to convert JavaScript property to mongo element a :
      Bulk/addToOperationsList@src/mongo/shell/bulk_api.js:600:22
      Bulk/this.insert@src/mongo/shell/bulk_api.js:647:14
      DBCollection.prototype.insert@src/mongo/shell/collection.js:256:13
      @(shell):1:1
      
      // Server-side JS
      > db.eval('db.foo.insert({a: Symbol()});');
      WARNING: db.eval is deprecated
      2015-07-22T15:18:00.853-0400 E QUERY    [thread1] Error: {
      	"ok" : 0,
      	"errmsg" : "Error: unable to convert JavaScript property to mongo element a :\nBulk/addToOperationsList@src/mongo/shell/bulk_api.js:600:22\nBulk/this.insert@src/mongo/shell/bulk_api.js:647:14\nDBCollection.prototype.insert@src/mongo/shell/collection.js:256:13\n_funcs1@:1:30\n",
      	"code" : 16662
      } :
      _getErrorWithCode@src/mongo/shell/utils.js:23:13
      DB.prototype.eval@src/mongo/shell/db.js:542:1
      @(shell):1:1
      

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            kamran.khan Kamran K.
            Votes:
            1 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: