-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 1.0.7
-
Component/s: Embedded Shell
-
None
-
Environment:Windows 10
Using MongoDB: 5.0.3
Using Mongosh: 1.0.7
-
Not Needed
The new mongosh is far away from being a successor of classic mongo shell. I would consider it more in "experimental state". I get several issues when running on Windows, some are listed below:
- Left/Right arrow cursor keys are not working at all, the cursor does not move
- Backspace key does not work: the cursor moves back, but characters are not deleted
- Up/Down arrow cursor keys are not working at all, you cannot access any command history
- Function `hostname()` is missing. Note, command `db.hostInfo().system.hostname` does not work, because `hostname()` shows current host whereas `db.hostInfo().system.hostname` shows host of `mongos`
$ echo $HOSTNAME
d-mipmdb-as-one
$ mongo --norc -quiet "mongodb://admin:*******@d-mipmdb-as-two/?authSource=admin"
mongos> hostname()
d-mipmdb-as-one
mongos> db.hostInfo().system.hostname
d-mipmdb-as-two
- Loading modules takes very much time (7 seconds vs. 0.05 seconds in classic mongo). Get same results also on Linux.
in mongosh (Windows): test> let t = ISODate(); test> load('c:/Developing/Javascript/moment-with-locales.js'); true test> print(ISODate() - t); 6962 in mongosh (Linux): [direct: mongos] mip> let t = ISODate(); [direct: mongos] mip> load('/home/mongod/moment-with-locales.js'); true [direct: mongos] mip> print(ISODate() - t); 7586 in classic mongo: > let t = ISODate(); > load('c:/Developing/Javascript/moment-with-locales.js'); true > print(ISODate() - t); 51
- Running scripts extremely slow
c:\>echo %TIME% 8:43:40.33 c:\>mongo -u admin -p *** --norc --quiet --eval "db.getMongo();" connection to 127.0.0.1:27017 c:\>echo %TIME% 8:43:40.55 => 0.2 seconds c:\>echo %TIME% 8:43:53.22 c:\>mongosh -u admin -p *** --norc --quiet --eval "db.getMongo();" mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000 c:\>echo %TIME% 8:45:20.16 => more than one Minute
- Loading [moment.js|https://momentjs.com/] module does not work
in mongosh: test> load('c:/Developing/Javascript/moment-with-locales.js'); true test> load('c:/Developing/Javascript/moment-timezone-with-data.js'); Uncaught: Error: Cannot find module 'moment' Require stack: - <repl> at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) at Function.Module._load (internal/modules/cjs/loader.js:745:27) at Module.require (internal/modules/cjs/loader.js:961:19) at require (internal/modules/cjs/helpers.js:92:18) at c:\Developing\Javascript\moment-timezone-with-data.js:6:1719 at c:\Developing\Javascript\moment-timezone-with-data.js:9:133 at c:\Developing\Javascript\moment-timezone-with-data.js:9:238 at c:\Developing\Javascript\moment-timezone-with-data.js:44:189084 at c:\Developing\Javascript\moment-timezone-with-data.js:44:189184 at Script.runInContext (vm.js:144:12) test> in classic mongo: > load('c:/Developing/Javascript/moment-with-locales.js'); true > load('c:/Developing/Javascript/moment-timezone-with-data.js'); true >
- Shell mongosh often just hangs, no further action possible. Need to terminate the command line shell
c:\>mongosh -u admin -p manager --norc --quiet test> exit; ... hanging
Honestly, it is a nightmare using the new mongosh. Using it on Linux is a little better, but still not usable.