0

Here I have a doubt. I want to create a db which stores the user data (i.e) username, password , etc;

It also includes the images the user uploaded. I'm okay if it saves a single image, all I've to do is to create a field name image and saves its path. But the question is what if the user uploads more images, in which format i can store the image? do i need to create multiple fields for multiple images??? Definitely its not the solution.

I want the best solution for storing multiple images for an user and fetch it back from the database to reflect it back in browser.

Thanks in advance!

1 Answer 1

1

Assuming that you want to store data within users collection only, then you can have images field as a array of object

{
  "userName" : "name of user",
  "password": "password of user",
  "images": [
      {
       //image 1 properties 
      },
      {
      //image N properties 
      }
  ],
 //more user properties
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.