简体   繁体   中英

Adding photos to users collection in mongodb

I am new to using mongodb, I have a collection of users, I want every user to upload some of their photos. So, I am thinking of creating property called images for every user document. this would be an array of images. However, I don't know if it's applicable or not, or how to do so. Any ideas? I am using node.js

There multiple libraries that are created to help store images in a MongoDB database. You can see some at this question: Store images in a MongoDB database

Also, for good design, you should consider having the images property containing IDs that correspond to the image, instead of the actual images themselves; it would be named imageIds .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM