Skip to content

Instantly share code, notes, and snippets.

@francolaiuppa
Created June 11, 2014 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francolaiuppa/9c02a490111ba6437f94 to your computer and use it in GitHub Desktop.
Save francolaiuppa/9c02a490111ba6437f94 to your computer and use it in GitHub Desktop.
How do I store statuses vs children data like comments
// each var is a collection
var ticketStatuses = [
{ 'id': ObjectId(), 'name': 'Pending', 'alias': 'pending' },
{ 'id': ObjectId(), 'name': 'In Progress', 'alias': 'in-progress' },
{ 'id': ObjectId(), 'name': 'Done', 'alias': 'Done' },
];
var tickets = [
{
'id': ObjectId(),
'description': 'Bla bla bla',
'statusId': ObjectId('one_of_the_objectIds_that_come_from_the_collection_above'),
'comments': [
{ 'id': ObjectId(), 'userId': ObjectId('user_id_goes_here'), 'comment': 'Bla bla bla', 'date': 'date_goes_here' }
]
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment