[SERVER-30769] Mongo shell throws 'exception during autocomplete' Created: 22/Aug/17  Updated: 30/Oct/23  Resolved: 20/Sep/17

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 3.5.12
Fix Version/s: 3.4.10, 3.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: Josef Ahmad Assignee: Mark Benvenuto
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Duplicate
is duplicated by SERVER-31036 Shell Autocomplete Throws Exception W... Closed
Related
related to SERVER-30362 JavaScript DBCollection.toString() st... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4
Sprint: Platforms 2017-10-02
Participants:
Case:

 Description   

$ git describe
r3.5.12-4-gdfc7ec9adb

When I tab to autocomplete my collection named "collection" in my database, the shell throws the following exception:
exception during autocomplete: "invalid 'in' operand o._proto_"

Following is a copy and paste of my mongo shell session (note I press TAB after typing in "col" to have it autocomplete to "collection")

[gulsef@localhost mongo]$ ./mongo
MongoDB shell version v3.5.12-4-gdfc7ec9adb
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.5.12-4-gdfc7ec9adb
Mongo-Hacker 0.0.14
Server has startup warnings:
2017-08-22T11:10:22.201+0100 I STORAGE [initandlisten]
2017-08-22T11:10:22.202+0100 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-08-22T11:10:22.202+0100 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten]
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** NOTE: This is a development version (3.5.12-4-gdfc7ec9adb) of MongoDB.
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** Not recommended for production.
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten]
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten]
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2017-08-22T11:10:22.251+0100 I CONTROL [initandlisten]
2017-08-22T11:20:44.294+0100 E QUERY [thread1] uncaught exception: don't know how to show [automationNotices]
localhost(mongod-3.5.12-4-gdfc7ec9adb) test> use decimal
switched to db decimal
localhost(mongod-3.5.12-4-gdfc7ec9adb) decimal> db.colexception during autocomplete: "invalid 'in' operand o._proto_"

Also note the "[thread1] uncaught exception: don't know how to show [automationNotices]" in the logs. Possibly related?



 Comments   
Comment by Stennie Steneker (Inactive) [ 06/Oct/17 ]

guillaume.meister The fixVersion for this Jira issue is 3.5.14, so the 3.5.12 and 3.5.13 dev releases will still throw exceptions for autocomplete. Until 3.5.14 is released, a workaround would be using the 3.5.11 or older mongo shells where this bug was not present.

FYI, if you want to test without executing .mongorc.js on startup you can run mongo --norc instead of deleting the rc file. This autocomplete bug is unrelated to shell extensions, though.

Regards,
Stennie

Comment by Guillaume Meister (Inactive) [ 05/Oct/17 ]

same issue with 3.5.13, even after I deleted .mongorc.js
reverting to 3.4.9 solves the problem.

Mongo-hacker is installed but I'm not using its .mongorc.js

Comment by Githook User [ 02/Oct/17 ]

Author:

{'email': 'mark.benvenuto@mongodb.com', 'name': 'Mark Benvenuto', 'username': 'markbenvenuto'}

Message: SERVER-30769 Mongo shell throws 'exception during autocomplete'

(cherry picked from commit 2b44ac6faf81d217a7418f0a55cc6b7f463e9dbe)
Branch: v3.4
https://github.com/mongodb/mongo/commit/454f3b84c5a30533d9d0fa22d9dc43988e5b88d9

Comment by Githook User [ 20/Sep/17 ]

Author:

{'email': 'mark.benvenuto@mongodb.com', 'name': 'Mark Benvenuto', 'username': 'markbenvenuto'}

Message: SERVER-30769 Mongo shell throws 'exception during autocomplete'
Branch: master
https://github.com/mongodb/mongo/commit/2b44ac6faf81d217a7418f0a55cc6b7f463e9dbe

Comment by Mark Benvenuto [ 22/Aug/17 ]

This is a regression from SERVER-30362. The "__proto__" member is now returning null which is breaking autocomplete. This was not caught in any automated tests.

Comment by Stennie Steneker (Inactive) [ 22/Aug/17 ]

Mongo-Hacker 0.0.14

Hi Josef,

I notice you are using Mongo-Hacker, which is a third party extension that overrides some of the default mongo shell behaviour. In particular, I expect this is the source of the "don't know how to show [automationNotices]" in your startup transcript. Upgrading to a newer version of Mongo-Hacker from GitHub will likely fix this error, but if not you should report in the Mongo-Hacker issue queue on GitHub.

You can test without any startup scripts using mongo --norc.

exception during autocomplete: "invalid 'in' operand o._proto_"

I can reproduce this error using the 3.5.12 shell without any startup scripts, so this seems to be a bug unrelated to Mongo-Hacker. Autocomplete works as expected in the 3.5.11 shell.

Regards,
Stennie

Generated at Thu Feb 08 04:24:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.