-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Shell
-
None
-
Environment:$ mongo --version
MongoDB shell version v4.2.3
git version: 6874650b362138df74be53d366bbefc321ea32d4
OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1804
distarch: x86_64
target_arch: x86_64
mongos> interpreterVersion()
MozJS-60
mongos> db.serverBuildInfo()
{
"version" : "4.2.3",
"gitVersion" : "6874650b362138df74be53d366bbefc321ea32d4",
"modules" : [ ],
"allocator" : "tcmalloc",
"javascriptEngine" : "mozjs",
"sysInfo" : "deprecated",
"versionArray" : [
4,
2,
3,
0
],
"openssl" : {
"running" : "OpenSSL 1.1.1 11 Sep 2018",
"compiled" : "OpenSSL 1.1.1 11 Sep 2018"
},
"buildEnvironment" : {
"distmod" : "ubuntu1804",
"distarch" : "x86_64",
"cc" : "/opt/mongodbtoolchain/v3/bin/gcc: gcc (GCC) 8.2.0",
"ccflags" : "-fno-omit-frame-pointer -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -O2 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-const-variable -Wno-unused-but-set-variable -Wno-missing-braces -fstack-protector-strong -fno-builtin-memcmp",
"cxx" : "/opt/mongodbtoolchain/v3/bin/g++: g++ (GCC) 8.2.0",
"cxxflags" : "-Woverloaded-virtual -Wno-maybe-uninitialized -fsized-deallocation -std=c++17",
"linkflags" : "-pthread -Wl,-z,now -rdynamic -Wl,--fatal-warnings -fstack-protector-strong -fuse-ld=gold -Wl,--build-id -Wl,--hash-style=gnu -Wl,-z,noexecstack -Wl,--warn-execstack -Wl,-z,relro",
"target_arch" : "x86_64",
"target_os" : "linux"
},
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216,
"ok" : 1,
"operationTime" : Timestamp(1582064070, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1582064070, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
$ mongo --version MongoDB shell version v4.2.3 git version: 6874650b362138df74be53d366bbefc321ea32d4 OpenSSL version: OpenSSL 1.1.1 11 Sep 2018 allocator: tcmalloc modules: none build environment: distmod: ubuntu1804 distarch: x86_64 target_arch: x86_64 mongos> interpreterVersion() MozJS-60 mongos> db.serverBuildInfo() { "version" : "4.2.3", "gitVersion" : "6874650b362138df74be53d366bbefc321ea32d4", "modules" : [ ], "allocator" : "tcmalloc", "javascriptEngine" : "mozjs", "sysInfo" : "deprecated", "versionArray" : [ 4, 2, 3, 0 ], "openssl" : { "running" : "OpenSSL 1.1.1 11 Sep 2018", "compiled" : "OpenSSL 1.1.1 11 Sep 2018" }, "buildEnvironment" : { "distmod" : "ubuntu1804", "distarch" : "x86_64", "cc" : "/opt/mongodbtoolchain/v3/bin/gcc: gcc (GCC) 8.2.0", "ccflags" : "-fno-omit-frame-pointer -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -O2 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-const-variable -Wno-unused-but-set-variable -Wno-missing-braces -fstack-protector-strong -fno-builtin-memcmp", "cxx" : "/opt/mongodbtoolchain/v3/bin/g++: g++ (GCC) 8.2.0", "cxxflags" : "-Woverloaded-virtual -Wno-maybe-uninitialized -fsized-deallocation -std=c++17", "linkflags" : "-pthread -Wl,-z,now -rdynamic -Wl,--fatal-warnings -fstack-protector-strong -fuse-ld=gold -Wl,--build-id -Wl,--hash-style=gnu -Wl,-z,noexecstack -Wl,--warn-execstack -Wl,-z,relro", "target_arch" : "x86_64", "target_os" : "linux" }, "bits" : 64, "debug" : false, "maxBsonObjectSize" : 16777216, "ok" : 1, "operationTime" : Timestamp(1582064070, 1), "$clusterTime" : { "clusterTime" : Timestamp(1582064070, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } }
-
Server Tooling & Methods
-
Service Arch 2020-04-06, Service arch 2020-04-20
-
(copied to CRM)
Mongo 3.2 release notes point out the change to use spidermonkey
https://docs.mongodb.com/manual/release-notes/3.2-javascript/
and link to the ES6 standard
http://www.ecma-international.org/ecma-262/6.0/index.html
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-map-objects
However, it appears that the Map object does not work properly in MongoDB shell. The object returned from the constructor looks like a minimal map type of thing that doesn't conform to the ES6 standard.
mongos> m = new Map() mongos> m = new Map(){ "_data" : { }, "put" : function(key, value) { var o = this._get(key); var old = o.value; o.value = value; return old;}, "get" : function(key) { return this._get(key).value;}, "_get" : function(key) { var h = Map.hash(key); var a = this._data[h]; if (!a) { a = []; this._data[h] = a; } for (var i = 0; i < a.length; i++) { if (friendlyEqual(key, a[i].key)) { return a[i]; } } var o = {key: key, value: null}; a.push(o); return o;}, "values" : function() { var all = []; for (var k in this._data) { this._data[k].forEach(function(z) { all.push(z.value); } ); } return all;}} mongos> m.clear() 2020-02-18T15:20:53.945-0700 E QUERY [js] uncaught exception: TypeError: m.clear is not a function :@(shell):1:1 mongos> m.delete() 2020-02-18T15:20:59.672-0700 E QUERY [js] uncaught exception: TypeError: m.delete is not a function :@(shell):1:1 mongos> m.entries() 2020-02-18T15:21:05.374-0700 E QUERY [js] uncaught exception: TypeError: m.entries is not a function :@(shell):1:1 mongos> m.forEach() 2020-02-18T15:21:11.367-0700 E QUERY [js] uncaught exception: TypeError: m.forEach is not a function :@(shell):1:1 mongos> m.get() null mongos> m.has() 2020-02-18T15:21:22.422-0700 E QUERY [js] uncaught exception: TypeError: m.has is not a function :@(shell):1:1 mongos> m.keys() 2020-02-18T15:21:27.405-0700 E QUERY [js] uncaught exception: TypeError: m.keys is not a function :@(shell):1:1 mongos> m.set() 2020-02-18T15:21:31.134-0700 E QUERY [js] uncaught exception: TypeError: m.set is not a function :@(shell):1:1 mongos> m.size mongos> m.values() [ null ]
- is related to
-
SERVER-34281 ES6 arrow functions (lambdas) do not work with map-reduce
- Closed
- related to
-
SERVER-50614 JS 'Set' type does not serialize well to BSON
- Backlog