Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories Atlas CLI
Created by Guest
Created on Sep 21, 2022

add option to return output as a text instead of array

when you call cli with -o json-path option you always recieve output as an array in brackets. it would be useful to add a key to return output as plain text, so it can used in scripts without further processing (the same way as aws cli does) : current state : ``` export org_id=$(atlas organizations list -o json-path='$.results[?(@.name =="MyOrg")].id' ) echo $org_id [5ccefa1079358eebfef9456e] ``` suggested output ``` echo $org_id 5ccefa1079358eebfef9456e ```
  • Guest
    Mar 2, 2023
    Hi, it seems like this is a known issue for json-path https://github.com/json-path/JsonPath/issues/272 and when using filters it will always return an array with no way to select only the first element Right now given this is outside of the control of the CLI I would recommend using json output and an additional tool like jq or using go template outputs until json path addresses this issue