Hi,
I’ve label and ticket collection in DB.
Each new ticket will be tagged with any of a label from label collection.
Each ticket will have label id and some of details about label.
And Each ticket has expiryTime as well.
label collection
// Sample label collection
[
{
id : 'label111',
name : 'jan',
taggedLabelcount : 0,
type="label"
},
{
id : 'label222',
name : 'feb',
taggedLabelcount : 0,
type="label"
}
]
ticket collection
// sample ticket collection
[
{
id : 'ticket111',
label : {
id : 'label111',
name : 'jan',
type="label"
},
expiryTime : '179800000223232232',
type= "ticket"
},
{
id : 'ticket222',
label : {
id : 'label111',
name : 'jan',
type="label"
},
expiryTime : '179800000223232232',
type= "ticket"
}
},
{
id : 'ticket333',
label : {
id : 'label111',
name : 'feb',
type="label"
},
expiryTime : '179800000223232232',
type= "ticket"
}
]
My requirement is :
When querying list of labels from DB,
I need to get the count of a label used in tickets (should not account the ticket if its past time from now)
and to update it in taggedLabelcount property in each label.
I tired with join query and unable to produce expected response
Thanks