GithubHelp home page GithubHelp logo

luukrijnbende / adminmongo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mrvautin/adminmongo

0.0 1.0 0.0 1.26 MB

adminMongo is a Web based user interface (GUI) to handle all your MongoDB connections/databases needs.

License: MIT License

JavaScript 77.95% CSS 1.46% HTML 20.59%

adminmongo's Introduction

adminMongo

npm downloads badge npm version badge Build Status Github stars

adminMongo is a Web based user interface (GUI) to handle all your MongoDB connections/databases needs. adminMongo is fully responsive and should work on a range of devices.

adminMongo connection information (including username/password) is stored unencrypted in a config file, it is not recommended to run this application on a production or public facing server without proper security considerations.

Installation

  1. Clone Repository: git clone https://github.com/mrvautin/adminMongo.git && cd adminMongo
  2. Install dependencies: npm install
  3. Start application: npm start
  4. Visit http://127.0.0.1:1234 in your browser

Deploy on Heroku

Deploy

Features

  • Manage from a connection level for easy access to multiple databases
  • Create/Delete databases
  • Create/Delete/Edit collection
  • Create/Delete/Edit documents
  • Create/Delete indexes
  • Query documents
  • Collection statistics
  • Export collections in JSON format

Current limitations

  • Documents need to have an "_id" value which is a string, integer, or MongoDB ObjectId. Documents using Composite ID indexing is currently not supported.
  • Connection strings with multiple hosts for replica sets are currently not supported.

Configuration

adminMongo will listen on host: localhost and port: 1234 by default. This can be overwritten by adding a config file in /config/app.json. For example:

{
    "app": {
        "host": "10.0.0.1",
        "port": 4321,
        "docs_per_page": 15,
        "password": "secureadminpassword",
        "locale": "de",
        "context": "dbApp"
    }
}

Note: Any changes to the config file requires a restart of the application

The config file (optional) options are:

Option Definition
host The IP address adminMongo will listen on
port The Port adminMongo will listen on
docs_per_page When viewing docs you can specify how many are shown per page
password An application level password to add simply authentication
locale The locale is automatically set to the detected locale of Nodejs. If there is not a translation, adminMongo will default to English. This setting overrides the default/detected value
context Setting a context of "dbApp" is like changing the base URL of the app and will mean the app will listen on http://10.0.0.1:4321/dbApp. Ommiting a context will mean the application will listen on root. Eg: http://10.0.0.1:4321. This setting can be useful when running adminMongo behind Nginx etc.

Setting a context path

Setting a context of "dbApp" is like changing the base URL of the app and will mean the app will listen on http://10.0.0.1:4321/dbApp. Ommiting a context will mean the application will listen on root. Eg: http://10.0.0.1:4321. This setting can be useful when running adminMongo behind Nginx etc.

An example Nginx server block. Note the location /dbApp { and proxy_pass http://10.0.0.1:4321/dbApp; lines match the context set in the /config/app.json file.

server {
    listen 80;

    server_name mydomain.com www.mydomain.com;

    location /dbApp {
        proxy_pass http://10.0.0.1:4321/dbApp;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Language locale

Looking for people to translate into other languages. If you can help, grab the /locale/en.js file, translate to your language and submit a pull request.

The locale is automatically set to the detected locale of Nodejs. If there is not a translation, adminMongo will default to English. To override the detected locale a setting can be added to the app.json file. See Configuration section for a "German" example.

Authentication

By default adminMongo is not password protected. You can add password authentication by adding a password value to the /config/app.json file (See the Configuration section). Once added you will need to restart adminMongo and all routes will be protected until the correct password is added. You will then be authenticated for the life of the session (60 mins by default) or if the "Logout" link is clicked.

Usage

Create a connection

After visiting http://127.0.0.1:1234 you will be presented with a connection screen. You need to give your connection a unique name as a reference when using adminMongo and a MongoDB formatted connection string. The format of a MongoDB connection string can form: mongodb://<user>:<password>@127.0.0.1:<port>/<db> where specifying to the <db> level is optional. For more information on MongoDB connection strings, see the official MongoDB documentation.

You can supply a connection options object (see docs) with each connection.

For example:

{
    "poolSize": 10,
    "autoReconnect": false,
    "ssl": false
}

Note: The connection can be either local or remote hosted on VPS or MongoDB service such as mLab.

The Connection setup screen adminMongo connections screen

Connection/Database admin

After opening your newly created connection, you are able to see all database objects associated with your connection. Here you can create/delete collections, create/delete users and see various stats for your database.

The connections/database screen adminMongo database screen

Collections

After selecting your collection from the "Database Objects" menu, you will be presented with the collections screen. Here you can see documents in pagination form, create new documents, search documents, delete, edit documents and view/add indexes to your collection.

The collections screen adminMongo collections screen

Searching/Querying documents

You can perform searches of documents using the Search documents button on the collections screen. You will need to enter the key (field name) and value. Eg: key = "_id" and value = "569ff81e0077663d78a114ce" (Only works on string "_id" fields - Use "Query Documents" for ObjectID's).

You can clear your search by clicking the Reset button on the collections screen.

Simple search documents adminMongo search documents

Complex querying of documents is done through the "Query documents" button. This allows a query Object to be passed to MongoDB to return results. Queries can be written in full BSON format or EJSON format. For example these queries should return the same results:

{ 
    ObjectId("56a97ed3f718fe9a4f599489")
}

is equivalent to:

{
    "$oid": "56a97ed3f718fe9a4f599489"
}

Query documents adminMongo search documents

Documents

Adding and editing documents is done using a JSON syntax highlighting control.

Editing a document adminMongo documents

Documents with Media embedded show previews

Documents with media adminMongo media

Indexes

Indexes can be added from the collection screen. Please see the official MongoDB documentation on adding indexes.

Viewing/Adding indexes adminMongo documents

Tests

The adminMongo API tests include:

  • Add and remove a connection
  • Add and remove a database
  • Add, remove and rename a collection
  • Create and delete a user
  • Add, query and delete a document

To run tests, simply run:

npm test

You may need to edit the variables and connection string in /tests/tests.js for your MongoDB instance.

If you see any missing tests, please submit a PR.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Future plans

Please make any suggestions.

License

The MIT License

adminmongo's People

Contributors

mrvautin avatar destromas1 avatar aymen-mouelhi avatar codymorrison avatar maitreyabuddha avatar diegovillacis10 avatar duksis avatar burn2delete avatar hunsu avatar rastopyr avatar vitaljok avatar

Watchers

Luuk Rijnbende avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.