SCRAPE-6: Implement upsertUnits() bulk operation #11
Reference in New Issue
Block a user
No description provided.
Delete Branch "scraper/upsert-units"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement upsertUnits() in scraperService.js using MongoDB bulkWrite with unordered operations. Uses unit_code as unique key, sets last_scraped and data_source on every upsert, preserves first_seen via setOnInsert. Handles empty arrays, logs results, and re-throws errors. Includes 23 tests covering all behaviors.