axfg
axfg

Reputation: 65

How to create new object for a new date in mongodb?

I want to change the value of a variable named count in mongodb. Count is needed for every day.

For example, if count changes from 15 to 17 in one day, i want to update the existing object. Again start the next day with 0 and keep track of it.

This way I will have 365 objects(in a year) for a user which has the count value for each day.

How to do it in mongodb? or is relational db more suitable for this?

Upvotes: 0

Views: 117

Answers (1)

Kitsor
Kitsor

Reputation: 144

Create an array of objects (counters) in the document and save the counter in a specific object. enter image description here

Upvotes: 1

Related Questions