databasemongodbweb-applicationsrelational-databasenon-relational-database

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?


Solution

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