Writing multi line query in terminal

I know , it is a little bit silly but I’m writing my queries in terminal (OS: Ubuntu ) , i need to make new line or write multi line query , so the query can be readable for me , as it would be disaster if i wrote every query in one line …

It is not silly at all.

Unless the query is really simple, I edit them in .js file and use load() on the .js. I use my favorite editor (vi). It specially useful with aggregation pipeline. In this case, I also define each stage as a variable this way I can add and remove stage easily until I get the wanted result.

1 Like