Page 1 of 1

Arrays & Objects Backend

Posted: Mon Mar 23, 2015 6:56 pm
by Jeremiah Olugbola

Hi I was wondering if someone can be of help! I am trying to create a sort of task management app for parties.
I would like to a user to select an option from a list (i.e party type) and it returns a set of predefined tasks for the user. I'm wondering how I can establish this from a back-end point of view. Would I need to create a tasks collection and have the tasks stored into an array in an object column? Or have a partytype collection that has an array of the different tasks for each party type?


Arrays & Objects Backend

Posted: Tue Mar 24, 2015 3:22 am
by Bruce Stuart

Personally - I believe this is a bit of a question on style and using Mongodb they way it was designed - v the way it works best.

So - I'd vote for a collection with your party_types in it (id, party_type_abbreviation, and a description of the party type - and I'd have a second collection called party_tasks (suggestion), and you have columns for task abbr, task name , and a column for party_type_id where you store the related id from the party_types - and when displaying the list of tasks - you use a where clause to limit the rows that come back == ( the party_type_id in the part_tasks === the id from the party_types table).

Easy to manage that through storing local_storage values , etc.

Just an opinion. To me - it's very messy dealing with the embedded arrays in a column with varying lengths - and hard to code.

Bruce


Arrays & Objects Backend

Posted: Tue Mar 24, 2015 12:45 pm
by Jeremiah Olugbola

Hi Bruce I'm a little bit new to using the Mongodb implementation..how would I link the party_type_id from one collection to the party_type collection?


Arrays & Objects Backend

Posted: Tue Mar 24, 2015 12:47 pm
by Jeremiah Olugbola

I know its to do with pointers, however im not sure on how to link a certain column of another collection