Usage
After installing Vi Mongo, you can run it by typing vi-mongo
in your terminal.
Key Shortcuts
In any moment you can press ?
to see the help page with all available shortcuts. Keybindings are mostly inspired by Vim, but some of them are customized for efficiency.
Essential Shortcuts
?
- Toggle full-screen helpCtrl+C
,q
- Close applicationCtrl+O
- Open connection pageCtrl+T
- Toggle style change modalCtrl+A
- Show AI query interfaceCtrl+S
- Show server infoAlt+o
- Show server infoTab
/Ctrl+L
- Focus next componentBacktab
/Ctrl+H
- Focus previous component
Navigation and Views
Vi Mongo offers multiple views and navigation patterns:
Main Views
- Connection View - Manage MongoDB connections
- Database Tree - Browse databases and collections
- Content View - View and manipulate documents
Content Display Modes
Press f
in the Content view to cycle through different document display modes:
- Table View - Documents displayed in a tabular format
- JSON View - Documents displayed in formatted JSON
- Single Line View - Documents displayed as compact JSON strings
Document Interaction
p
orEnter
- Quick peek at documentP
- Full page peekE
- Edit documentD
- Duplicate documentd
- Delete documentc
- Copy highlighted contentC
- Copy entire document
Modal Windows
Vi Mongo uses several modal windows for different operations:
Theme Changing Modal (Ctrl+T
)
The theme changing modal allows you to select different visual styles:
- Navigate through available themes with arrow keys
- Press
Enter
to apply the selected theme - Press
Esc
orCtrl+T
again to exit without changing
Query Options Modal (Alt+o
)
This modal provides advanced options for document querying:
- Projection - Specify fields to include/exclude in the results
- Limit - Set the maximum number of documents to return
- Skip - Number of documents to skip before starting to return
Press Apply
to confirm settings or Cancel
to dismiss.
AI Query Modal (Ctrl+A
)
The AI assistant helps you create MongoDB queries:
- Select an AI model from the dropdown
- Enter your query request in natural language
- Press
Ask LLM
to generate a MongoDB query - Press
Apply Query
to use the generated query
Note: This feature requires API keys for OpenAI or Anthropic to be set in your environment variables.
Document Peeker
When peeking at documents:
g
- Move to topG
- Move to bottomc
- Copy highlightedC
- Copy only valueF
- Toggle full screenp
,P
- Exit peeker
Query/Filter Bar (/
)
Toggle the query bar to filter documents:
Ctrl+Y
- Show query historyCtrl+D
- Clear inputCtrl+V
- Paste from clipboard
Advanced Features
Column Management
S
- Sort by current columnH
- Hide current columnCtrl+R
- Reset hidden columns
Pagination
n
- Next pageb
- Previous page]
- Next document[
- Previous document
Database Operations
E
- Expand all nodes in database treeW
- Collapse all nodesA
- Add new collectionD
- Delete collectionR
- Rename collection
Connection Management
The connection page allows you to configure MongoDB connections:
-
Connection List - Left side shows saved connections
Enter
orSpace
- Select connectionD
- Delete selected connectionCtrl+L
orCtrl+Right
- Focus on form
-
Connection Form - Right side for editing connection details
Ctrl+S
orEnter
- Save connectionCtrl+H
orCtrl+Left
- Focus connection list
Working with Documents
Document Views
The content view allows you to interact with documents in different ways:
- Table View: Provides column-based view with data types indicated
- JSON View: Shows the complete formatted JSON structure
- Single Line View: Compact representation of documents
Document Editing
When editing documents:
- Changes are made in your default text editor (defined by the
EDITOR
env variable or in config) - File is saved in JSON format
- Document is validated before saving to MongoDB
- Special MongoDB types like ObjectID, Date, etc. are preserved
Query Building
The query bar accepts standard MongoDB query syntax:
You can also use the AI Query feature (Ctrl+A
) to generate queries using natural language.
Sorting Documents
The sort bar (s
) accepts MongoDB sort syntax:
You can also quickly sort by a column by pressing S
when the column is selected.
Projection
To show specific fields:
or to hide given field
Rember that you cannot combine both 0
and 1
in one projection.
Troubleshooting
If you encounter any issues while using Vi Mongo feel free to open a new issue on our GitHub repository.
Possible issues:
- Keybindings not working as expected (refer to Configuration Guide)
- Icons missing or not properly displayed - this is very common problem in terminal applications, either change them in the config file or install Nerd Font/Icons
- General performance issues (for very large databases and collections)
- Regex search not working the same as in MongoDB documentation (eg,
/pattern/
will not work as expected, use{ "$regex": "pattern", "$options": "i" }
instead). Fix listed in the Roadmap - MongoDB types are not yet properly tested so have in mind that some types like
BSONSymbol
orCode
can be misssing or not displayed properly.
Resizing Terminal
Resizing the terminal while running Vi Mongo should work fine, as it's based on tview library which is fully rezisable, but if you encounter any issues, please file an issue on GitHub.
Additional Resources
By following these guidelines, you should be able to effectively use Vi Mongo for your MongoDB management needs. If you have any further questions or need assistance, please refer to the documentation or reach out to me e-mail.