Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create MongoDB database with Adminer #626

Closed
5 of 7 tasks
robots4life opened this issue Aug 29, 2019 · 3 comments
Closed
5 of 7 tasks

Cannot create MongoDB database with Adminer #626

robots4life opened this issue Aug 29, 2019 · 3 comments
Assignees

Comments

@robots4life
Copy link

ISSUE TYPE

  • Bug Report

Checklist

env.txt

OS / ENVIRONMENT

  1. Host operating system and version: Distributor ID: Ubuntu
    Description: Ubuntu 18.04.2 LTS
    Release: 18.04
    Codename: bionic
  2. (Windows) Native Docker or Docker Toolbox:
  3. Docker version: Docker version 19.03.1, build 74b1e89
  4. Docker Compose version: docker-compose version 1.23.2, build 1110ad01
  5. (Linux) Is SELinux enabled?:
  6. What git commit hash are you on?:

SUMMARY

  • Using Adminer I like to create a MongoDB database and tables. When I try to create a table I get the following error.
    Fatal error: Uncaught Error: Call to a member function createCollection() on null in /var/www/default/htdocs/vendor/adminer-4.7.1-en.php:1202 Stack trace: #0 /var/www/default/htdocs/vendor/adminer-4.7.1-en.php(1840): alter_table('', 'item', Array, Array, NULL, '', '', '', '') #1 {main} thrown in /var/www/default/htdocs/vendor/adminer-4.7.1-en.php on line 1202.

  • When I simply just create a MongoDB database inside Adminer and then log out of Adminer and go back to check https://localhost/db_mongo.php the newly created database is not listed, it is not there.

STEPS TO REPRODUCE

  1. docker-compose up -d
  2. Go to localhost, then click > Tools > Adminer.
  3. On Adminer Login page select System : MongoDB and Server : mongo. I could not find info in the docs on the MongoDB Username or Password so I just leave those empty.
  4. Next click Create database, give it a name, Save, done. Even though this database seems to have been created it does not show when going to https://localhost/db_mongo.php. Why?
  5. Still in Adminer, with the newly created database click Create table, give it a name and hit Save.
  6. Then you get Fatal error: Uncaught Error: Call to a member function createCollection() on null in /var/www/default/htdocs/vendor/adminer-4.7.1-en.php:1202 Stack trace: #0 /var/www/default/htdocs/vendor/adminer-4.7.1-en.php(1840): alter_table('', 'item', Array, Array, NULL, '', '', '', '') #1 {main} thrown in /var/www/default/htdocs/vendor/adminer-4.7.1-en.php on line 1202.

EXPECTED BEHAVIOUR

Being able to create MongoDB databases and tables with Adminer.

ACTUAL BEHAVIOUR

Created database is never saved or shown under https://localhost/db_mongo.php.
Fatal error when trying to create database table.

OTHER INFORMATION

Start command

$ docker-compose up -d

File and user permissions (Linux & MacOS)

$ id
uid=1000, gid=1000, docker=999
$ ls -la
root
$ ls -la data/www
root
@robots4life
Copy link
Author

Creating the MongoDB database and collections via the CLI inside the PHP container works. Once that is done and a document (db entry) is created the database also starts showing on https://localhost/db_mongo.php.

So I made a database with a User and Password.
But still, when I try to log on to that specific database via the Adminer login page I get this error.
Database does not support password.

However in my code, in the connection string, when I change the user or password I cannot connect, so for me that proves that the database in question does indeed have the right user and access rights.

Here is the code I used to make a user and password for the database.

db.createUser(
  {
    user: "user",
    pwd: "password",
    roles: [ { role: "readWrite", db: "simpleappdb" } ]
  }
)

When I go into Adminer and just select System : MongoDB and Server : mongo I can see the database that was created with the CLI. However if I try to change it or add to it I get various fatal errors, depending on if I am trying to add, edit or delete a document or collection.

Why does it say Database does not support password. when I try to login through Adminer?

@stale
Copy link

stale bot commented Oct 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue:stale This issue has become stale and is marked for auto-close label Oct 28, 2019
@stale stale bot closed this as completed Nov 4, 2019
@cytopia cytopia reopened this Nov 17, 2019
@stale stale bot removed the issue:stale This issue has become stale and is marked for auto-close label Nov 17, 2019
@cytopia cytopia self-assigned this Nov 17, 2019
@cytopia
Copy link
Owner

cytopia commented Nov 21, 2019

@robots4life Works fine here. What PHP, Mongo and Adminer version are you using?

Screenshot 2019-11-21 13-38-56  selection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants