Search code examples
mongodbprompt

Customize mongo-hacker prompt


I want to customize the prompt in mongo-hacker on Mac. Too much space is being taken up with my (shortened) path, mongo version, and current db name.

My-Macbook(mongod13.2.4) myMongoDB >

My ideal prompt shows only the current database:

myMongoDB >

Solution

  • Assuming you can build the mongo-hacker from the source, following steps should solve your problem:

    1. Clone the mongo-hacker repo to your local computer.
    2. Open hacks/prompt.js with your favorite text editor.
    3. Change the return statement to return db + '> ';
    4. Save and build.