0

enter image description here

I want to try out executing javascript from mongo shell. mongo test --eval "printjson(db.getCollectionNames())"

However, I'm getting the error as you can see on the above screenshot.

1 Answer 1

1

The "--eval" option is used in Scripted mongo, you should not be already connected to the shell. Use that as in an example below:

mongo YOUR_DB_NAME --eval "printjson(db.getCollectionNames())"
Sign up to request clarification or add additional context in comments.

1 Comment

ah, tnx Oleksandr :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.