M
M
Maxim Vasiliev2014-08-15 10:42:26
MongoDB
Maxim Vasiliev, 2014-08-15 10:42:26

How to scroll dataset by date?

The task, apparently, is elementary, but it wedges me a lot and I don’t see a simple, natural and beautiful solution point-blank.
In short: there is data sorted in reverse chronological order, you need to get a sample fragment starting from a certain date, but without filtering the rest of the data.
Probably solved by means of only one database, but just in case, I'll post the whole alignment.
The database (mongodb) stores records with date stamps. There is an index by date. Natural order roughly corresponds to chronological order.
The selection is carried out by a query with a filter on the values ​​of some fields and with sorting always in reverse chronological order (other sorting does not make much sense).
In the interface, the data is displayed in the form of a table dynamically loaded by scrolling (dojo dgrid + dojo/store/JsonRest). When scrolling, the widget requests a range per page/fragment, such as 1-25, 25-50, etc.
Communication of the interface with the backend via the JSON REST API, for paging, the Range and Content-Range HTTP headers are used with the "items" unit (Range: items 25-50, Content-Range: items=25-50/1000)
In theory, if in the response give out some sudden range, the table should understand this.
Actually, you need to do something like this so that the user selects an approximate date in the interface, and data is loaded into the table starting from this date, but with the ability to rewind forward / backward.
PS
Well, or nafik dojo, I will migrate all this to angular. But it seems to me that this is not important when saving http rest.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question