-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.1.0
-
Component/s: CLI Module
-
None
-
Needed
-
Problem Statement/Rationale
Output from --eval commands in mongosh are unable to be parsed by jq
Steps to Reproduce
I've included the commands I'm running in the "Additional notes" section
Expected Results
I expect the output of mongosh to match mongo, or at least be parse-able by jq
Actual Results
Parse exception when passed into jq
Additional Notes
Output is different between the 2 different shell applications. `mongo` is able to be parsed by `jq`, where mongosh will have the following error `parse error: Invalid numeric literal at line 2, column 7` (using `jq '.[]'` as only set of filtering still causes this parse error)
$ mongosh --quiet -u <username> -p <pass> --host rs0/<host> --eval "rs.status().members.map(function(m) { return {{
{'id':m._id, 'name':m.name, 'stateStr':m.stateStr}}}});"
{{ [}}
{ id: 0, name: '<ip1>:27017', stateStr: 'PRIMARY' },
{ id: 1, name: '<ip2>:27017', stateStr: 'SECONDARY' },
{{ { id: 2, name: '<ip3>:27017', stateStr: 'SECONDARY' }}}
{{ ]}}
{{ $ mongo --quiet -u <username> -p <pass> --host rs0/<host> --eval "rs.status().members.map(function(m) { return }}{{
}}});"
{{ [}}
{
"id" : 0,
"name" : "<ip1>:27017",
"stateStr" : "PRIMARY"
}}}{{,
{
"id" : 1,
"name" : "<ip2>:27017",
"stateStr" : "SECONDARY"
}}}{{,
{
"id" : 2,
"name" : "<ip3>:27017",
"stateStr" : "SECONDARY"
{{ }}}
]