The command to get the database name in the shell:
> db.getName()
While you just type db, you will find that this only works interactively, and if you work with a script, this may not give the desired result.
Asya Kamsky Apr 15 '13 at 3:13 2013-04-15 03:13
source share