node-mongo-admin
v4.0.0
Published
A simple web application to visualize mongo data inspired by PHPMyAdmin
Downloads
13
Readme
Node Mongo Admin
A simple web application to visualize mongo data inspired by PHPMyAdmin
Install
- Clone the repo
- Copy the file
example-config.js
toconfig.js
and edit what you want - Start with
node index
or, if you havepm2
,npm start
Features
- Multiple connections
- Multiple users and permissions
- Table-like display
- HTTPs and BasicAuth
- Relaxed query language (accepts not only JSON, but also plain JS)
- Right click to quick search (even between databases)
- Support for distinct and aggregate query
- Export to HTML
- API to prompt users for one or many ids (see bellow)
Example
Credits
Icons by FamFamFam
Prompt API
Another window can open a node-mongo-admin's window to prompt the user for one or many ids.
Example:
var promptWindow = window.open(baseUrl + '?promptOne')
window.onmessage = function (event) {
if (event.source === promptWindow) {
console.log(event.data)
}
}
Use browser APIs (like window.open()
or <iframe>
) to render frame with the interface. Append '?promptOne'
or '?promptMany'
to the end of the URL to activate prompt mode. In this mode, the user can only make simple queries and have access to the "Return selected" button.
When the user clicks that button, the child window will emit a message to the opener window with data
in the following format:
{
"type": "return-selected",
"connection": "connection name",
"collection": "collection name",
"ids": ["id1", "id2", "id3"]
}
Note that ids
is an array, even in the promptOne
mode. In this case, it'll have only one element.
You can also provide initial values for the connection and collection fields in the URL with: ?promptOne&connection-name&collection-name