0

I'm working with ReactJS, ExpressJS and MongoDB to create a website. I need to specify category for documents in a Mongo collection. I also need to save images.

Do you think I should convert my images to binary and save them directly into MongoDB? And do you think I should make a Category model, or should I just add a category property that saves an array of strings that are properties?

1 Answer 1

1

About saving images as binary - this answer has a very good explanation. https://stackoverflow.com/a/7705404/140693

About category, you can declare an attribute like "category" and validate it with ENUM (if your categories are static) or use an async validator if the categories list is dynamic/complex.

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.