'Asking for a sorting algorithm where data location has a strong correlation with time
I'm an intern at a company, and I study math, so my terminologies might be very off.
I have a large database in MongoDB. I would describe some collections like this,
- There is a door where everything goes into, denote this by A**.** All items are recorded in A, and some important information is only available in A. Every item is given a unique itemID (that is NOT the '_id' automatically given when we insert a document).
- After going through A, all items are then sorted to some other collections B,C,D, and each document that went through A goes to exactly one of the three. The documents in each collection have their itemID, so theoretically we can match the documents from B,C,D with their unique document in A.
- All items finally go through E, again retaining their itemID.
- There is a somewhat strong correlation between documents in A and in B,C,D and E. Documents in A,E contain time,date, while documents in B,C,D contains date. Necessarily for an item, the time is 'smallest' in A, then B/C/D, then E.
What kind of problem am I looking at here? Is there a specific sort/problem that fits my description? Also is it wise to do this in the aggregation pipeline of MongoDB? My pipeline (an intern's) was terribly slow, while a code given to me (to study) uses dictionaries instead, and is much much faster.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
