Mongoose gridfs-stream how to populate fs.file collection Mongoose gridfs-stream how to populate fs.file collection mongoose mongoose

Mongoose gridfs-stream how to populate fs.file collection


user.photo is of type Schema.Types.ObjectId. Therefore, user.photo.filename will not exist.

You need to have the image files uploaded to gridfs and get the fileId given to the image in the fs.files collection. You can then set user.photo to be the fileId of the file in fs.files.