pretty print in mongo shell not working - MongoDB 2.6 + Yosemite + ZSH [duplicate] - mongodb

This question already has an answer here:
How do I get colorized query output and shell in MongoDB?
(1 answer)
Closed 8 years ago.
I'm running the mongo shell by invoking mongo at the command line. The result is a bland shell experience. I would like to see colored JSON output, etc. I tried running:
> db.my_collection.find().pretty()
but it didn't work.
I also tried adding the following line to ~/.mongorc.js:
DBQuery.prototype._prettyShell=true
but it didn't work.

Try the MongoDB shell enhancement. You can make particular tweaks after you clone the repo.

Related

Can't run mongo command on windows [duplicate]

This question already has answers here:
mongo.exe not installed in Version 6.0.0
(7 answers)
mongosh is a valid command but mongo is not found
(2 answers)
Closed 13 days ago.
I tried t to set up Community MongoDB on my windwos pc. I followed the installation process and tried to set up the environment variables. I copied the pathes from my explorer, so the pathes should be correct. screenshot of my env
Nonetheless I can't use any mongo commands on my command shell. Anytime I try to run "mongo" or "mongodb" or "mongo --version" it says "command is either misspelled or couldn't be found". screenshot of my cmd shell
When I use the command "mongod" some strange code appears screenshot of my cmd shell
How can I solve this problem?
Found the solution: you have to set up mongoshell first and then you can use the command "mongosh" to use it with the windows command. This tutorial helped me set everything up: youtube.com/watch?v=V-d6VAYrjeQ

prompt not appearing after running `perl` [duplicate]

This question already has answers here:
How can I start an interactive console for Perl?
(24 answers)
Closed 1 year ago.
I have asked a similar question elsewhere but it eventually evolved into a series of comments. So once again, what package should I install to see the following prompt > after running perl but now not raku (all under Cygwin)?
EDIT
-l doesn't work either.
EDIT 2
Perl -d -e1 doesn't work for me either (Answer in comments as this question is closed):
You didn't provide the name of a program, and you didn't provide a program via the -e or -E command line options, so it's reading the program from STDIN.
perl does have a builtin debugger that you access by passing -d, but you still need to provide a program. (You can provide a trivial one using -e1.)
See How can I start an interactive console for Perl? for alternatives.

Can not open "help" with \h or \? in psql on Windows 10. Command "more" is not written corectly, it says [duplicate]

This question already has answers here:
What causes "More is not recognized..." error when running Postgresql 11 on a Windows machine?
(1 answer)
psql "more is not recognized" error
(8 answers)
Closed 2 years ago.
I'm very new to coding and these things so I already have problems with the post-installation phase. I'm using Windows 10 and downloaded PostgreSQL11.
I've already downloaded psql and watched a few tutorials. After the shell demands me to type in my password etc. I pressed " help" and then I pressed "\h". The last command "\h" , the shell doesn't recognize it, and it says something like (I have it in German so it may not be 1:1):
The command "more" is not written correctly or could not be found.
I have already tried to insert the path of my bin folder (C:\Program Files\PostgreSQL\11\bin) into the system variables of my pc. And also inserted the new variable for my lib (C:\Program Files\PostgreSQL\11\lib). But it still doesn't work.
What can I do to fix it?

Scala Execute Shell file [duplicate]

This question already has answers here:
Execute shell script from scala application
(2 answers)
Closed 5 years ago.
I have a .sh file in which I want to run in Scala once a Gatling scenario has finished.
Does anyone have any code that would execute my sh script.
You should use the after block provided by Gattling :-
Refer this : https://gatling.io/docs/current/general/simulation_structure/#hooks
Here you can use after block :-
after { println("Simulation is finished!")}
Rest all is pure scala so use #Andrey answer above

How to run a local script in mongo shell - Solution load() [duplicate]

This question already has answers here:
How to execute mongo commands through shell scripts?
(22 answers)
Closed 5 years ago.
I think this is a very basic question but I'm stuck. I'm connected to remote mongo instance (mLab) via a MongoDB shell. This has been fine for one-liners, but now I want to run larger commands but often, thus the need to do it from an already connected shell.
How can I run my local script.js from the mongo shell and get the output in the shell, as if I'm just running the one-liner per usual?
I was hoping load("script.js") would do it, but it just returns 'true' regardless of the content.
Execute a JavaScript file
You can specify a .js file to the mongo shell, and mongo will execute the JavaScript directly. Consider the following example:
mongo localhost:27017/test myjsfile.js
Replace the Localhost URL with your Mlab URL
Or if you are in the shell You can execute a .js file from within the mongo shell, using the load() function, as in the following:
load("myjstest.js")
refer to this link
Modify your script file to print all items in a result cursor , use the following idiom:
cursor = db.collection.find();
while ( cursor.hasNext() ) {
printjson( cursor.next() );
}