[SERVER-32628] Couldn't get output from mongo shell on windows for some edge cases Created: 10/Jan/18  Updated: 15/Nov/21  Resolved: 18/Jan/18

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 3.4.8
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Yi Zhao Assignee: Mark Agarunov
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows Pro10


Attachments: PNG File screenshot-1.png    
Participants:

 Description   

If I type this command through mongo shell db.test.explain().find(), I should get a json output about the explain. It doesn't work for some cases I am not sure why. After investigating I found that below is the explain.find function definition in javascript.

rs0:PRIMARY> db.test.explain().find
function () {
            var cursor = this._collection.find.apply(this._collection, arguments);
            return new DBExplainQuery(cursor, this._verbosity);
        }

compare with below command:

rs0:PRIMARY> db.test.find().explain
function (verbose) {
    var explainQuery = new DBExplainQuery(this, verbose);
    return explainQuery.finish();
}

it looks like the previous one miss finish() call. I don't know why this finish is not called in some cases on windows.



 Comments   
Comment by Yi Zhao [ 18/Jan/18 ]

Hello Mark,

Thanks for checking it. But I don't think it is a VS code problem. VS code works fine on Mac and Linux. This issue only happens on windows. It can be easily reproducible on windows 10 pro. It happens when you put `explain` in front of the `find` like: `db.test.explain().find()`. But it works fine if you put the `explain` at the end of `find`.
Besides VS code, I can also reproduce this issue through hyper which is another terminal application.

Comment by Mark Agarunov [ 18/Jan/18 ]

Hello zhaoyi0113@gmail.com,

Thank you for the information. Looking at the screenshot, it appears that the explain() command had the proper output but it was truncated by the terminal, indicating this is likely an issue in the VSCode terminal as opposed to the mongo shell. Unfortunately without reproducible instances where the explain() output is incorrect we cannot definitively diagnose the cause of this issue.

Thanks,
Mark

Comment by Yi Zhao [ 16/Jan/18 ]

Hello Mark,

This happens when I use VS Code terminal on Windows 10 Pro. I have attached the screenshot.

Comment by Mark Agarunov [ 10/Jan/18 ]

Hello zhaoyi,

Thank you for the report. To get a better idea of what the cause may be, could you please provide some of the cases where the explain command doesn't return output?

Thanks,
Mark

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