TylerBrock / mongo-hacker

MongoDB Shell Enhancements for Hackers
tylerbrock.github.io/mongo-hacker
MIT License
1.79k stars 235 forks source link

Error when starting mongo shell: `uncaught exception: don't know how to show [automationNotices]` #187

Closed gianpaj closed 5 years ago

gianpaj commented 6 years ago
$ mongo
MongoDB shell version v3.6.2
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.2
Mongo-Hacker 0.0.14
Server has startup warnings:
2018-02-21T14:03:38.999+0000 I CONTROL  [initandlisten]
2018-02-21T14:03:38.999+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-02-21T14:03:38.999+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-02-21T14:03:38.999+0000 I CONTROL  [initandlisten]
2018-02-21T14:03:45.087+0000 E QUERY    [thread1] uncaught exception: don't know how to show [automationNotices]
Gianfrancos-MacBook-Pro(mongod-3.6.2) test>

Which query/command could it be? mongod logs

2018-02-21T14:04:15.949+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:56724 #4 (2 connections now open)
2018-02-21T14:04:15.949+0000 I NETWORK  [conn4] received client metadata from 127.0.0.1:56724 conn: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "3.6.2" }, os: { type: "Darwin", name: "Mac OS X", architecture: "x86_64", version: "16.7.0" } }
2018-02-21T14:04:15.949+0000 I COMMAND  [conn4] command admin.$cmd appName: "MongoDB Shell" command: isMaster { isMaster: 1, client: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "3.6.2" }, os: { type: "Darwin", name: "Mac OS X", architecture: "x86_64", version: "16.7.0" } }, $db: "admin" } numYields:0 reslen:223 locks:{} protocol:op_query 0ms
2018-02-21T14:04:15.950+0000 I COMMAND  [conn4] command admin.$cmd appName: "MongoDB Shell" command: whatsmyuri { whatsmyuri: 1, $db: "admin" } numYields:0 reslen:47 locks:{} protocol:op_msg 0ms
2018-02-21T14:04:15.950+0000 I COMMAND  [conn4] command admin.$cmd appName: "MongoDB Shell" command: buildInfo { buildinfo: 1.0, $db: "admin" } numYields:0 reslen:1444 locks:{} protocol:op_msg 0ms
2018-02-21T14:04:15.952+0000 I COMMAND  [conn4] command admin.$cmd appName: "MongoDB Shell" command: buildInfo { buildinfo: 1.0, $db: "admin" } numYields:0 reslen:1444 locks:{} protocol:op_msg 0ms
2018-02-21T14:04:15.953+0000 I COMMAND  [conn4] command admin.$cmd appName: "MongoDB Shell" command: getLog { getLog: "startupWarnings", $db: "admin" } numYields:0 reslen:446 locks:{} protocol:op_msg 0ms
2018-02-21T14:04:15.954+0000 I COMMAND  [conn4] command admin.$cmd appName: "MongoDB Shell" command: serverStatus { serverStatus: 1.0, $db: "admin" } numYields:0 reslen:24676 locks:{ Global: { acquireCount: { r: 2 } } } protocol:op_msg 0ms
2018-02-21T14:04:15.958+0000 I COMMAND  [conn4] command admin.$cmd appName: "MongoDB Shell" command: buildInfo { buildinfo: 1.0, $db: "admin" } numYields:0 reslen:1444 locks:{} protocol:op_msg 0ms
2018-02-21T14:04:15.959+0000 I COMMAND  [conn4] command admin.$cmd appName: "MongoDB Shell" command: replSetGetStatus { replSetGetStatus: 1.0, $db: "admin" } numYields:0 reslen:106 locks:{} protocol:op_msg 0ms
2018-02-21T14:04:15.960+0000 I COMMAND  [conn4] command test.$cmd appName: "MongoDB Shell" command: isMaster { isMaster: 1.0, $db: "test" } numYields:0 reslen:208 locks:{} protocol:op_msg 0ms
michaelfdias commented 6 years ago

You probably installed it through npm, right?

The project is outdated on npm because it doesn't keep sync with GitHub automatically.

You can compare the hacks/show.js file installed by npm on your machine and the current on GitHub repository to understand why it is occurring.

gianpaj commented 6 years ago

Yes, is installed via npm.

If I replace the .show() function in ~/.mongorc.js with the one from show.js, then yes there is no error.

I wonder why npm doesn't have the latest .show() since it was last edited in 2 Nov 2016.

$ npm list -g --depth=0 mongo-hacker
/Users/gianfranco/.nvm/versions/node/v8.11.1/lib
└── mongo-hacker@0.0.15
michaelfdias commented 6 years ago

The last publish on npm was 2 years ago, before fix show function.

stennie commented 5 years ago

This should be resolved with Mongo Hacker 0.0.16 published to npm in Oct 2018.