Todd6808807
Posts: 0
Joined: Fri Jul 18, 2014 12:34 pm

Database design best practice

Hi,

Im about to do the Camera Component tutorial & had a question around database design.

I have a need to store multiple photos per database record that also has some other fields.

So my question is should I create a separate db or even collection or simply add some fields into my existing collection?

Thanks in advance

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Database design best practice

Hello Todd,

You shouldn't create new database. Please tell us how do you keep the picture - as a file and in the collection you store the name of a file or in collection you keep base64encoded string with the content of the file?

Todd6808807
Posts: 0
Joined: Fri Jul 18, 2014 12:34 pm

Database design best practice

Thanks for responding Evgene,

What would be best practice? Im happy to do whatever is best.

Todd6808807
Posts: 0
Joined: Fri Jul 18, 2014 12:34 pm

Database design best practice

just a reminder that there may be up to 5 photos that relate to the record. For example a record in the collection might relate to an event. That event might have fields date, location & comments. Attached to that event can be up to the 5 photos.

Thanks

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Database design best practice

Hi Todd,

This depends on app logic. For example, you could store images in Database Files and store images names in a field of array type.

Todd6808807
Posts: 0
Joined: Fri Jul 18, 2014 12:34 pm

Database design best practice

Thanks for your response I'm not sure what is the best way to go (even based on your above answer)

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Database design best practice

Both are applicable.

Return to “Issues”