Get data from different collections (.files , .chunks and master data) in MongoDB

Viewed 25

I am trying to upload the user details along with picture in the mongoDB using GridFS and multer. I need to get the data along with all the pictures to be displayed in the tabular form in client side(using angular).

The problem is the picture is getting stored in user.files and user.chunk collections, where as the other data like userID, userDesignation, userName is stored in user collection. How could I retrieve the data from both the collections in one GET userData API?

there is a option for merge the data using $lookup but that needs to have a common key in both the collections, whereas in my case there is common key.

0 Answers
Related