The uploader is now functional, however it currently only works when the -replace flag is provided. This means that we can only ever replace all of the data in the DB rather than simply updating things that have changed. This is unwanted for a multitude of reasons, including the fact that is makes the DB far more mutable than it needs to be and performs an enormous amount of unnecessary writes.
Luckily, the main cause of this is fairly simple -- when replacing old documents with a $merge pipeline, we cannot modify the immutable _id field of the original document, or, in other words, we cannot change the _id between the old and new version.
There is a problem that comes with this, however, which I will outline with an overview of how the data collection process works:
- Data is scraped
- Scraped data is parsed, links between courses/profs/sections are created (via
_id references)
- Parsed data is uploaded via either replacement or update via
$merge aggregate
The problem lies in the second point above -- any new "links" that have been created between newly parsed courses/profs/sections will be using new _ids, not the original ones. Thus, if we were to simply ignore the new _ids when performing the $merge, we would end up with countless invalid links.
Thoughts on how to resolve this are welcome, there are multiple ways that we could implement a solution.
The uploader is now functional, however it currently only works when the
-replaceflag is provided. This means that we can only ever replace all of the data in the DB rather than simply updating things that have changed. This is unwanted for a multitude of reasons, including the fact that is makes the DB far more mutable than it needs to be and performs an enormous amount of unnecessary writes.Luckily, the main cause of this is fairly simple -- when replacing old documents with a
$mergepipeline, we cannot modify the immutable_idfield of the original document, or, in other words, we cannot change the_idbetween the old and new version.There is a problem that comes with this, however, which I will outline with an overview of how the data collection process works:
_idreferences)$mergeaggregateThe problem lies in the second point above -- any new "links" that have been created between newly parsed courses/profs/sections will be using new
_ids, not the original ones. Thus, if we were to simply ignore the new_ids when performing the$merge, we would end up with countless invalid links.Thoughts on how to resolve this are welcome, there are multiple ways that we could implement a solution.