Skip to content

Improve uploader to work without -replace flag #27

Description

@jpahm

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:

  1. Data is scraped
  2. Scraped data is parsed, links between courses/profs/sections are created (via _id references)
  3. 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.

Metadata

Metadata

Assignees

Labels

Help WantedExtra attention is neededL3A task suitable for someone who is comfortable implementing large-scale features/projects.Status: On HoldThis has been delayed for a future sprint or release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions