Code Monkey home page Code Monkey logo

mongodb-php-gui's Introduction

Free MongoDB GUI powered by PHP

Visually administrate your MongoDB database. Create, read, update & delete your documents.
Query your MongoDB database with a relax JSON syntax, regular expressions & SQL statements.
Autocompletion is available for collection fields, MongoDB & SQL keywords via key shortcuts.
Export documents to JSON. Import documents from JSON. Manage indexes. Manage users, etc.

Screenshots

MongoDB PHP GUI - Visualize Database

MongoDB PHP GUI - Query Documents

Installation

Docker (PHP built-in server)

  1. In a case of an upgrade, run docker pull samueltallet/mongodb-php-gui
  2. Always run docker run --add-host localhost:172.17.0.1 --publish 5000:5000 --rm samueltallet/mongodb-php-gui
  3. Open your browser at this address: http://127.0.0.1:5000/ to access GUI.

Apache HTTP server

  1. Clone current repository in a folder served by Apache.
  2. Be sure to have PHP >= 7.3 with MongoDB extension enabled.
  3. Check that rewrite_module module is enabled in your Apache configuration.
  4. Be sure to have AllowOverride All in your Apache (virtual host) configuration.
  5. Run composer install at project's root directory to install all PHP dependencies.
  6. Optionnaly, if you want to query DB with SQL, you must have Java JDK installed.
  7. Open your browser at Apache server URL to access GUI.

Usage

Query Syntax

Relaxed JSON

MongoDB PHP GUI supports a relaxed JSON syntax. In practice, this query:

city: New York

Will produce same result that:

{ "city": "New York" }

Regular Expressions

Imagine you want to find all the US cities starting with "San An". This query:

city: /^San An/

Will output:

  • San Antonio (FL)
  • San Angelo (TX)
  • ...

SQL Statements

If Java JDK is installed, you can query MongoDB with SQL statements such as:

SELECT * FROM Cities WHERE state = "CA"

Key Shortcuts

Ctrl + Space Autocomplete the query
Ctrl + * Count doc(s) matching the query
Ctrl + Enter Find doc(s) matching the query

Credits

This GUI uses Limber, Capsule, Font Awesome, Bootstrap, CodeMirror, jsonic, JsonView, MongoDB PHP library, vis.js and SQL to MongoDB Query Converter. Leaf icon was made by Freepik from Flaticon.

Funding

If you find this GUI useful, donate at least one dollar to support its development. Thank you to all! ❤️

Copyright

© 2022 Samuel Tallet

mongodb-php-gui's People

Contributors

patrickdk77 avatar peterfromthehill avatar samueltallet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mongodb-php-gui's Issues

Use MySQL to store PHP session data

Add an option that you can provide MySQL connection data in the index.php and that session data will be stored in MySQL database when it was provided

Accessing through subdirectory (reverse proxy)

Hi!
Thanks for this project.

I'm trying to set it up in a subdirectory with Docker (/mongoadmin). However I can't set the base URL, so the resources won't load correctly:

image

Is there a way to specify the BASE_URL?

Thanks in advance

Login for user having only database specific roles

Hi

context

I've a test environment with a test mongo database and a test user account:

  • a dedicated mongo user account
  • this user is associated to a custom role targeting only test database:

(example on mongodb.com > manage access view > custom role)

image

NB/ in following example, I replaced real data with "blah blah".

uri login test case

When using "mongo uri login page" with following entry

 mongodb+srv://testuser:[email protected]/test-database?retryWrites=true&w=majority

Then I got the following Screen:
image

detailed fields login test case

If I retry using "detailed fields login ui", then I'm able to get in and I see

  • my database name in upper-left corner
  • but on db name click, I'got a 500 with the following alert message :
Error: No suitable servers found (`serverSelectionTryOnce` set): [Failed to resolve 'blah.blah.mongodb.net']

NB: I got no more logs on docker side:

[Sun Dec  5 14:51:34 2021] 172.21.0.1:53274 Accepted
[Sun Dec  5 14:51:34 2021] 172.21.0.1:53274 [500]: POST /listCollections
[Sun Dec  5 14:51:34 2021] 172.21.0.1:53274 Closing

mongo shell test

Please note that if I'm trying to connect from command line in order to list collections, I've no issue

mongo.exe mongodb+srv://testuser:[email protected]/test-database?retryWrites=true\&w=majority
PRIMARY> show collections
.coll
collB

expected evolution

I expect to use MongoDB-PHP-UI even if my security context doesn't allow me to list all databases (end so on.. manage index/users..)

If I've no access to some feature, I may have a feedback to understand that point
If I've only database read/and/or/write access, then I must be able to use MongoDB-PHP-GUI related feature (find/count..)

No input file specified.

I've installed it on apache with php 8.1.9. Installed all dependencies with composer. No errors shown.
When i open the page it routes to login# and shows a blank page with the message: No input file specified.

Login page: do not retain credentials

Hi

On login page we set some sensible credentials (ex. db access).
image

As php gui user, I dont want that the browser retains form value for this field. I dont want autocomplete. I dont want to be able to retrieve mongodb url from my previous access.

Technically, the input may have autocomplete="off" or type=password somewhere .. to dig.

Please notice that this issue is not the opposite of #37 but independant enhancement. This issue drives the "default browser behavior". At the end, if the user want to store some information, this is a choice that should not be forced.

This is a security issue.
Thanks
Regards

Query database: returned fields

I would like a way to setup the field(s) to return.

for example for a Person, I would have an extra text field to set {"name":1, "age":1}
(or it could be a bunch of checkboxes)

Login with connection URI

Accept mongo DB connection URI instead of writing user, password, host, port and database. There should be a button to switch to connection URI authorization on the login page.

Shared hosting

Is this hostable on shared hosting without access to the cmd line?

Access through a reverse proxy

Hello @SamuelTS,

First of all thanks for your work and for sharing it!

I'm trying to make the UI run, I have the requirement that it has to run behind a reverse proxy. For that I need two things:

(1) I could solve via a special docker setup hack [hack 1]. Albeit it would be certainly nicer to have an environment variable like: docker run -p 5000:5000 samueltallet/mongodb-php-gui. -e CONTEXT='/my/base/url' or like 2b:
docker run -p 5000:5000 samueltallet/mongodb-php-gui. -e ABS_URI='https://host.com/my/base/url'

(2) My big problem is the login redirect as can be seen here:
image

It's just not good (for this setup).

I'm wondering if you would feel comfortable having 2a or rather 2b implemented in the codebase.

Thanks for your answer in advance.

Regards,
Viktor

[hack 1]

FROM php:7.4-cli-alpine

WORKDIR /opt/

RUN apk update && apk add --no-cache --virtual .build-deps autoconf build-base openssl-dev curl \
  && pecl install mongodb-1.8.2 && docker-php-ext-enable mongodb \
  && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
  && apk del .build-deps \
  && apk add --no-cache openjdk8-jre git

RUN git clone https://github.com/SamuelTS/MongoDB-PHP-GUI \
  && mkdir -p /opt/mongodb-php-gui/api/mongo-ui/ \
  && mv MongoDB-PHP-GUI/* /opt/mongodb-php-gui/api/mongo-ui/

WORKDIR /opt/mongodb-php-gui/api/mongo-ui/

RUN composer install

WORKDIR /opt/mongodb-php-gui/
EXPOSE 5000

CMD ["php", "-S", "0.0.0.0:5000"]

Database visualization gets really slow with huge dataset

Hi Samuel,

as mentioned in the title, the database visualization tab gets really slow when displaying a lot of data. Maybe you can provide a configuration property (gui or docker environment variable) for toggling (show/hide) this tab?
Example: 15+ databases with around 5-10+ collections each.

Best regards

Error: 404 Not Found

Already installed everything needed, including composer install , but it displayed 404 not found. Am I missing something?

Login page: store multiple target connection URIs

This is a feature request

I've a mongo instance per dev / per integration / per production.
Each time I use MongoDB-PHP-GUI, I have to go back to my creds to pick mongo URI and past it on GUI.

I would like a feature to store my different login:

  • On login page I could save an URI and name the connection (ex. using browser cookies?)
  • Next time I go to the login page I have the choice: re-use existing saved URI, or input a new one.
  • I can remove an existing saved URI from GUI.

Deny access to private files to improve security

All site files are in DocumentRoot, so direct request to any *.php file is allowed. Tested some of them (for example /routes.php) - got 500 Internal server error. I think it would be better to have DocumentRoot dir with only things needed to be publicly accessible and leave all other outside DocumentRoot.
What do you think ?

Optimization of data visualization

Data visualization now displays the contents of the Document in a single window in the output, with no page-turning support. You can display each element of the document in a separate window, then edit the contents of that item individually, add a limit on the maximum number of displays per page, and turn the page to the last item, which feels easier to manage the data.

like this:
f3c04c11056b55bf90d6ef810728b6f

or this:
a51fc10b0100464227c550629d8c080

Display connection errors on login page

I think that when you type MongoDB login details it should try to connect to MongoDB. If the connection was not successful, display an error on the login page and don't let the user go to the dashboard.

Add reference to the GitHub repository/issues

As user, I would like to know where the project is hosted.

support point of view:

  • to report a bug
  • to report a improvment

help point of view

  • to access project's readme

this could help end users and make some ads for this repo

suggest to add link either on home page and/or on top level menu once logged

URI login problem

I'm able to connect successfully to a (Bitnami) MongoDB container by clicking on "I don't have an URI" and then entering the relevant details. Once logged in, I can see the database that I've set up in the MongoDB container listed under "Databases", towards the top left of the web page.

When I try the same credentials using the mongodb://user:pass...[etc] URI, I can also get logged in, but the difference is that I cannot see the database. On the page being displayed, there's nothing listed under "Databases".

Any help or advice much appreciated.

Can't insert exported data

In base one document
array[1] 0{5} _id{1} $oid:5f325f98114bec5750892193 email:[email protected] emailVerified{1} $date{1} $numberLong:1597141066973 createdAt{1} $date{1} $numberLong:1597136792802 updatedAt{1} $date{1} $numberLong:1597141066984

exporter
[ { "_id": { "$oid": "5f325f98114bec5750892193" }, "email": "[email protected]", "emailVerified": { "$date": { "$numberLong": "1597141066973" } }, "createdAt": { "$date": { "$numberLong": "1597136792802" } }, "updatedAt": { "$date": { "$numberLong": "1597141066984" } } } ]

when try insert get error
Error: invalid document for insert: keys cannot begin with "$": "$date"

Various feature requests for navigation and search

Hi Samuel,

So far the project is really great!
Nevertheless, I have a few feature requests that came up while using the web gui in a larger development environment:

  1. Saving connection details so they don't have to be entered manually each time.
  2. Selection of available hosts in the connection details window
  3. Display of the total number of records in the collection in the navigation bar (left side), example: "testCollection (2581)".
  4. A separate scrollbar for the databases and collections (left side), so that the whole page does not always scroll when you want to go to the bottom of the navigation.
  5. "Expand" and "shrink" on search results should expand and shrink all subelements respectively

I hope that some or even all features will make it into the product.
Keep up the good work!

Thanks a lot

Attachments:
Example screenshot of collection size in "Rockmongo": http://www.w3big.com/mongodb/rockmongo.png
grafik

Bad redirect - Weird layout

I just finished setting up the gui on Ubuntu 20.10 using the apache 2 method. But my site looks like this weirdly:
grafik

Please help me

Support for ARM64 architecture

Hey,

Arm64 is not supported over docker. Will you add it?

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Secure login with hCatpcha

Add option that you can add hcaptcha, so before connecting to DB, users need to complete captcha on the login page.

Bad redirect - Weird layout

Hi could you please explain how can I install and serve the application from a subfolder?
Instead of serving the application from http://domain.com, I would like to serve it from http://domain.com/mongodb.

I'm trying to create a Docker image, for which you can configure the basepath.
The Dockerfile I'm using is:

FROM registry.hub.docker.com/library/php:7.4.16-apache-buster

COPY docker-entrypoint.sh /docker-entrypoint.sh

ENV VERSION="v1.1.0"
WORKDIR /var/www/html
RUN \
    apt-get update && \
    apt-get install -y build-essential git unzip && \
    pecl install mongodb-1.8.2 && \
    docker-php-ext-enable mongodb && \
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
    a2enmod rewrite

CMD ["bash", "/docker-entrypoint.sh"]

and docker-entrypoint.sh is

#!/usr/bin/env bash

if [ ! -f /initialized ]; then
  echo "Installing into ${PWD}"
  git clone https://github.com/SamuelTS/MongoDB-PHP-GUI.git .
  git checkout "tags/${VERSION}" -b "${VERSION}"
  composer install
  touch /initialized
fi

apache2-foreground

I think I'm missing something in the rewrite rules for Apache, but unfortunately this is not my area of expertise and I can't properly debug the issue.

With the current rewrite rules if I access http://domain.com/mongodb/login# everything works as expected, but if I access http://domain.com/mongodb I get redirected to http://domain.com/mongodb//index/login# and everything is broken.

Could you provide some guidance?

Thanks in advance.

Login fields configurable via env vars

For automated deployments it is desirable to pre-populate the login fields for user, host, port, database so these do not have to be looked up by the operator every time they need to login.

Publish image to Docker Hub

Would you consider publishing the Docker image to Docker hub? You can do it for free using the Dockerhub free plan which already integrates with Github.

Quick edit full document entry

I've seen the way to quick edit a given document attribute when your mouse is hover a given field, you have a pen with a input form to edit the attribute content 👍

but now I need to quickly refactor the whole document:

  • add a new attribute,
  • bulk remove some part
  • ...

One simple way to do that is to add an "edit mode"

in current mode, add a EDIT button on a result array > data row

a clic on this button will switch to "edit mode"
in "edit mode"

  • text area contains the whole document to edit
  • all buttons are replaced by a SAVE and a CANCEL button

so cancel return in initial mode without saving
and save return to initial mode after saving document

Edit document null attribute doesn't work

Hi @SamuelTallet

Starting from a find on a given collection, I got a json document as result.

If a given attribute has a value ; ex. name : Joe: by clicking on joe I can update the value and this works well.

but if a given attribute has a null value ; ex. name : null: by clicking on null I cant update the value and this produces following JavaScript console logs:

VM74:1 Uncaught SyntaxError: Unexpected token d in JSON at position 0
    at JSON.parse (<anonymous>)
    at MPG.helpers.convertStringToAny (queryDatabase.js:152:64)
    at HTMLDivElement.<anonymous> (queryDatabase.js:508:49)

image

Support for ISODate format

in mongo console I see
"createdAt" : ISODate("2020-08-11T09:06:32.802Z")

but in interface I see
createdAt{1} $date{1} $numberLong:1597136792802

and date in this format hard to edit

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.