简体   繁体   中英

How many MongoDB Collections required

I am just starting with MongoDB, So please help me decide how many collection and collection fields will be required to implement below functionality.

在此处输入图片说明

Here I have total five images with their respective title and description which will be managed by Admin of the website. So I need to keep all the image urls, titles and descriptions and pagID in mongodb, So how many collections and their fields I will be required to achieve this task.

Read about MongoDB data modelling here .

You could use just one collection for the functionality you have stated.

Sample document would be like :

{
    _id: ObjectId('fe67543457687798ab12'),
    url: 'www.example.com/img/qwerty.jpg',
    title: 'Image 1',
    description: 'Description 1',
    pagID: 'some ID'
}

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