Here’s the scenario, a user logs in. based on his “id” and the current month of the year I will to update the document.
If there’s already data about him in this month then icrement (exemple 09-21 , user 1)
if not insert into the document.(09-21 someNewUser).
I read the documentation but I didn’t really help and I also looked for similar questions but none was helpful.
Thanks it works ! I appreciate it .
Can you please just tell me in the case of the data model you suggested, how can I count logins for a specific month.
select count(logins) as compte from bucket stats
UNNEST OBJECT_VALUES(stats.months) AS months
UNNEST OBJECT_VALUES(months.logins) AS logins
where meta(stats).id = ‘monthly-stats’ and months = ‘09-2021’;
Without the last condition “months = ‘09-2021’;” it works but doesn’t work with that condition (I suppose it’s a syntax thing but I don’t know how should I do it )
thanks in advance