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?
CodePudding user response:
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.