mongo-express / mongo-express-docker

a dockerized mongo-express for viewing mongoDB in the browser
MIT License
198 stars 93 forks source link

"Delete all" broken in latest release #103

Open camalot opened 8 months ago

camalot commented 8 months ago

If you attempt to "Delete All" from a collection the server crashes and logs the following error

2023-10-10T00:35:46.021960762Z /node_modules/mongo-express/lib/routes/collection.js:84
2023-10-10T00:35:46.021983745Z           ...result,
2023-10-10T00:35:46.021988073Z              ^
2023-10-10T00:35:46.021991550Z 
2023-10-10T00:35:46.021995016Z TypeError: result is not iterable
2023-10-10T00:35:46.021998673Z     at exp._buildMongoQuery (/node_modules/mongo-express/lib/routes/collection.js:84:14)
2023-10-10T00:35:46.022002541Z     at exp.deleteCollection (/node_modules/mongo-express/lib/routes/collection.js:448:23)
2023-10-10T00:35:46.022006077Z     at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
2023-10-10T00:35:46.022009594Z     at next (/node_modules/express/lib/router/route.js:144:13)
2023-10-10T00:35:46.022013050Z     at mongoMiddleware (/node_modules/mongo-express/lib/router.js:260:5)
2023-10-10T00:35:46.022016557Z     at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
2023-10-10T00:35:46.022020053Z     at next (/node_modules/express/lib/router/route.js:144:13)
2023-10-10T00:35:46.022023600Z     at Route.dispatch (/node_modules/express/lib/router/route.js:114:3)
2023-10-10T00:35:46.022027187Z     at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
2023-10-10T00:35:46.022030693Z     at /node_modules/express/lib/router/index.js:284:15
2023-10-10T00:35:46.022034130Z
BlackthornYugen commented 8 months ago

Thanks for the bug report. I will try to reproduce tomorrow. Is this the latest docker release (1.0.0) or latest npm release (1.0.2)?

camalot commented 8 months ago

Latest docker

camalot commented 8 months ago

my compose


mongo-express:
    user: 1000:1000
    hostname: mongo-express
    container_name: mongo-express
    image: mongo-express:latest
    ports: 
      - 49068:8081
    volumes:
      - /mnt/container_data/mongo-express/config/config.js:/config.js
    environment:
      ME_CONFIG_MONGODB_ENABLE_ADMIN: true
      ME_CONFIG_MONGODB_AUTH_USERNAME: 'root'
      ME_CONFIG_MONGODB_AUTH_PASSWORD: '**************************************'
      ME_CONFIG_MONGODB_ADMINUSERNAME: 'root'
      ME_CONFIG_MONGODB_ADMINPASSWORD: '*************************************'
      ME_CONFIG_MONGODB_URL: mongodb://mdbroot:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@mongo.my-internal.local:27017/
      ME_CONFIG_BASICAUTH: true
      ME_CONFIG_BASICAUTH_USERNAME: 'admin'
      ME_CONFIG_BASICAUTH_PASSWORD: '**********************************'
      ME_CONFIG_MONGODB_ALLOW_DISK_USE: true
    restart: unless-stopped
    networks:
    - internal
    dns:
    - 192.168.2.1
    - 1.1.1.1
    - 1.0.0.1
    - 8.8.8.8
    - 8.8.4.4
    dns_search: my-internal.local
BlackthornYugen commented 8 months ago

Reproducible on mongo-express:1.0.0 (arm64). I'll test with 1.0.1 and/or 1.0.2 shortly.

mongo-express-docker-mongoexpress-1  | /node_modules/mongo-express/lib/routes/collection.js:84
mongo-express-docker-mongoexpress-1  |           ...result,
mongo-express-docker-mongoexpress-1  |              ^
mongo-express-docker-mongoexpress-1  | 
mongo-express-docker-mongoexpress-1  | TypeError: result is not iterable
mongo-express-docker-mongoexpress-1  |     at exp._buildMongoQuery (/node_modules/mongo-express/lib/routes/collection.js:84:14)
mongo-express-docker-mongoexpress-1  |     at exp.deleteCollection (/node_modules/mongo-express/lib/routes/collection.js:448:23)
mongo-express-docker-mongoexpress-1  |     at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
mongo-express-docker-mongoexpress-1  |     at next (/node_modules/express/lib/router/route.js:144:13)
mongo-express-docker-mongoexpress-1  |     at mongoMiddleware (/node_modules/mongo-express/lib/router.js:260:5)
mongo-express-docker-mongoexpress-1  |     at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
mongo-express-docker-mongoexpress-1  |     at next (/node_modules/express/lib/router/route.js:144:13)
mongo-express-docker-mongoexpress-1  |     at Route.dispatch (/node_modules/express/lib/router/route.js:114:3)
mongo-express-docker-mongoexpress-1  |     at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
mongo-express-docker-mongoexpress-1  |     at /node_modules/express/lib/router/index.js:284:15
mongo-express-docker-mongoexpress-1  | 
mongo-express-docker-mongoexpress-1  | Node.js v18.18.0
mongo-express-docker-mongoexpress-1  |
GabrielBragaGit commented 8 months ago

same here, it's broken... had to downgrade to 1.0.0-alpha.4 to work...

raphaelsander commented 8 months ago

Hi,

Version 1.0.0-alpha.4 is working well for me by now.