V
V
Vitaly2017-05-22 16:06:49
MongoDB
Vitaly, 2017-05-22 16:06:49

What would be the best approach to the database structure?

All the best! I'm starting to study the database, I chose Mongo, and now I decided to use it in my educational project, instead of a text file :) But now I'm faced with the choice of a parable implementation of the database writing / reading structure. In the database I plan to record the statistics of operations, and the date of the reset / report. Can you please tell me whether it will be correct to divide the database into 2 collections? Write logs in the first one, and the date of the report reset in the second one (the date from which the logs will be read), or write everything to one collection and at the time of resetting the report date write something like that to the same collection
{"resetTime":"2017.05.17 09:29:26"}
and then, when displaying logs, filter the result from this entry ....
That is, the point is to write logs and display them through the web, but you need to display them only those that come from the reset date

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lega, 2017-05-22
@lega

Write logs, and delete the collection for reset.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question