Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
fixed _id overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
the-robot committed Feb 17, 2020
1 parent 07bd6f3 commit faa46c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/db/facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ const updateCountryCase = async document => {
document.added_date = new Date(new Date().toUTCString());
await dbo.collection(COLLECTIONS.countries_latest_cases).insertOne(document);
} else {
console.log('updating')
document.added_date = new Date(new Date().toUTCString());
await dbo.collection(COLLECTIONS.countries_latest_cases).updateOne(
{_id: existingRecord._id},
Expand Down
4 changes: 2 additions & 2 deletions src/tasks/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const pullCoronaCasesData = async () => {
countries.forEach(async document => {
// add affected country name
await insertCountryIfNotExists(document.country);
await insertCoronaCase(document);
await insertCoronaCase({...document});
// store individual country lastest update data
await updateCountryCase(document);
await updateCountryCase({...document});
});
};

Expand Down

0 comments on commit faa46c6

Please sign in to comment.