Nelly-Barret / BETTER-fairificator

The fairification tools for BETTER project.
https://www.better-health-project.eu/
0 stars 0 forks source link

Specify an update policy #4

Closed Nelly-Barret closed 3 weeks ago

Nelly-Barret commented 1 month ago

See what has been described for ExminationRecord instances in https://github.com/Nelly-Barret/BETTER-fairificator/issues/3.

We may have to choose between (i)update the vlaue with the new one, (ii) keep the old value

Nelly-Barret commented 1 month ago

See my comment here: https://github.com/Nelly-Barret/BETTER-fairificator/issues/3#issuecomment-2140261925

We can either replace the existing tuple with the given one, or do nothing (i.e., simply add new Resource isntances and do nothing for the already existing ones).

This may be dangerous to update the existing tuples because one cannot be sure that what is in the database reflects the content of the instance in the code. To be seen.

Nelly-Barret commented 3 weeks ago

With upsert, one can specify wether to:

  1. insert the document if it does not exist, do nothing otherwise ($setOnInsert);
  2. insert the document if it does not exist, update the document otherwise ($set).

This is implemented at 5e3c39a789f20e6c7e3ef71bf0ccac2ce80ee2f5 through the Enum UpdatePolicy.