0

I am trying to make an application like instagram using node.js. The problem that I am facing is how to store the user specific data? I am a beginner in making these type of projects.

An user registers -> then logins -> then uploads picture. I have a collection of users from where I do the Authentication. Now, I am stuck. I have thought of the way the application works but I am confused on how to get the images that a user uploads? I know how I store the images in a database but I don't know how to make them user specific.

In other words : Suppose userA uploads an image and userB uploads an image. How can I store them in a database? - Do I store them together and when one userA logs in I GET the images with his name or do I store those differently?

If I store all the images of all users at a single collection then it would be really slow if a huge number of images and users are there. I want to know about some method that will let me store the images uploaded by user at a specific contiguous memory , maybe or any other way.

Any Resource and help is appreciated.

Thank You

1 Answer 1

1

if you want to develop such an application, you should think about whether it would make more sense not to save the images in the database but in a file system.

In the database you then only save the path (perhaps in an array) to the respective images and possibly meta data of the images, such as the upload date. As a result, your database will not be that big, backups can be carried out faster and normal storage is usually cheaper than database storage.

Since is very easy to interact with the file system with nodejs , this would be a good solution.

Another option would be to use mongoDB GridFS. however, I don't know enough about it to explain this here.

I hope I could help you

Sign up to request clarification or add additional context in comments.

1 Comment

Ok.. So something like cloud containers . I have read something like Azure cloud container.. Do you have any recommended resource to look into?

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.