Be careful with quote signs

I just wanted to let you know that you should be careful with quote signs while evaluating mongo commands.
I nearly wrecked my head as to why this statement wouldn’t work:
mongo admin --eval “db.auth(“alice”,“secret”)”

but this works:

mongo admin --eval “db.auth(‘alice’,‘secret’)”

Apparently you should always mix these two different quote signs for the command to work fine.


There are some difference to consider. Have a look at this article on Single vs Double Quotes in the Shell.

1 Like