MongoDB Documentation, Release 3.0.4 11.3 FAQ: The mongo Shell 11.3.1 How can I enter multi-line operations in the mongo shell? If you end a line with an open parenthesis ( ’(’ ), an open brace ( ’{’ ), or an open bracket ( ’[’ ), then the subsequent lines start with ellipsis ( "..." ) until you enter the corresponding closing parenthesis ( ’)’ ), the closing brace ( ’}’ ) or the closing bracket ( ’]’ ). The mongo shell waits for the closing parenthesis, closing brace, or the closing bracket before evaluating the code, as in the following example: You can exit the line continuation mode if you enter two blank lines, as in the following example: You can use db.getSiblingDB() method to access another database without switching databases, as in the fol- lowing example which first switches to the test database and then accesses the sampleDB database from the test database: The mongo shell supports keyboard shortcuts. For example, Because there are many collection methods starting with the letter ’c’ , the <Tab> will list the various methods that start with ’c’ . db.myCollection.c<Tab> For a full list of the shortcuts, see Shell Keyboard Shortcuts New in version 1.9. You can change the mongo shell prompt by setting the prompt variable. This makes it possible to display additional information in the prompt. Chapter 11. Frequently Asked Questions 756 11.3.4 How can I customize the mongo shell prompt? 11.3.3 Does the mongo shell support tab completion and other keyboard shortcuts? 11.3.2 How can I access different databases temporarily? > if (x > 0 ... ... > > if ( x > 0 ) { ... count++; ... print (x); ... } • Use the up/down arrow keys to scroll through command history. See .dbshell documentation for more informa- tion on the .dbshell file. • Use <Tab> to autocomplete or to list the completion possibilities, as in the following example which uses <Tab> to complete the method name starting with the letter ’c’ : db.getSiblingDB('sampleDB').getCollectionNames(); use test