Running at localhost:8080
Error: The database connection must be open to store files
at GridFsStorage._handleFile (/mnt/ap/ap/node-js-upload-image-mongodb/node_modules/multer-gridfs-storage/lib/gridfs.js:175:12)
at /mnt/ap/ap/node-js-upload-image-mongodb/node_modules/multer/lib/make-middleware.js:145:17
at allowAll (/mnt/ap/ap/node-js-upload-image-mongodb/node_modules/multer/index.js:8:3)
at wrappedFileFilter (/mnt/ap/ap/node-js-upload-image-mongodb/node_modules/multer/index.js:44:7)
at Busboy.<anonymous> (/mnt/ap/ap/node-js-upload-image-mongodb/node_modules/multer/lib/make-middleware.js:115:7)
at Busboy.emit (events.js:400:28)
at Busboy.emit (/mnt/ap/ap/node-js-upload-image-mongodb/node_modules/busboy/lib/main.js:38:33)
at PartStream.<anonymous> (/mnt/ap/ap/node-js-upload-image-mongodb/node_modules/busboy/lib/types/multipart.js:213:13)
at PartStream.emit (events.js:400:28)
at HeaderParser.<anonymous> (/mnt/ap/ap/node-js-upload-image-mongodb/node_modules/dicer/lib/Dicer.js:51:16) {
storageErrors: []
}
{"message":"Error when trying upload many files: Error: The database connection must be open to store files"}
Node.js Upload multiple images to MongoDB example using Multer, GridFsStorage and mongod
For more detail, please visit:
https://github.com/bezkoder/node-js-upload-image-mongodb
Front-end Apps to work with this Node.js Server:
Angular 8 Client / Angular 10 Client / Angular 11 Client / Angular 12 Client
Angular Material 12
Vue Client / Vuetify Client
React Client / React Hooks Client
Material UI Client
More Practice:
Associations:
Integration (run back-end & front-end on same server/port)
Project setup
Run
Output
Attempt to connect to the database
Output
Mongod port
Output
Start the mongod database server
Go to route files
Output
Output
Upload a file
Output
Console Output