Stop Pretty default Mongo Shell (mongosh)

Team, in the old mongo shell you were able to pretty print using .pretty()

I jsut installed the new version, which is mongosh, and pretty printing is by default. When I am looking at multiple records, I find it inconvenient. Does anyone know how to turn off pretty print by default in mongosh …or at all?

Thank you

1 Like

You might try the configuration variable inspectCompact documented here

Hmm, I just tried my suggestion and it’s not terribly effective.

I didn’t know about the mongo shell settings. I spent all of yesterday looking, so thank you very much!
There doesn’t seem to be an option that does exactly that. Perhaps the new shell design doesn’t allow for it

Yes, I think it may be so that there’s no way to format better the output in the mongosh interactive shell.
Perhaps writing your own function in JS within the shell would output the way you want.