-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.1.6
-
Component/s: JavaScript, Shell
-
Query Execution
-
Dev Tools 2019-11-04
-
None
-
None
-
None
-
None
-
None
-
None
-
None
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