Skip to content

Commit

Permalink
fix: new mongodb exports for obsolete products collection (#10794)
Browse files Browse the repository at this point in the history
add exports of obsolete products (requested by MyLabel app)

Co-authored-by: Off <off@openfoodfacts.org>
  • Loading branch information
stephanegigandet and Off authored Sep 19, 2024
1 parent 3e8fee7 commit c22fc42
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/mongodb_dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ cd $DIR
pushd data/ > /dev/null
mongoexport --collection products --host $HOST --db $DB | gzip > new.$PREFIX-products.jsonl.gz && \
mv new.$PREFIX-products.jsonl.gz $PREFIX-products.jsonl.gz
mongoexport --collection products_obsolete --host $HOST --db $DB | gzip > new.$PREFIX-products_obsolete.jsonl.gz && \
mv new.$PREFIX-products_obsolete.jsonl.gz $PREFIX-products_obsolete.jsonl.gz

mongodump --collection products --host $HOST --db $DB --gzip --archive="new.${PREFIX}-mongodbdump.gz" && \
sha256sum new.$PREFIX-mongodbdump.gz |sed -e 's/new\.//' > new.gz-sha256sum && \
Expand All @@ -23,6 +25,13 @@ mv new.${PREFIX}-mongodbdump.gz ${PREFIX}-mongodbdump.gz && \
mv new.gz-sha256sum gz-sha256sum && \
mv new.gz-md5sum gz-md5sum

mongodump --collection products_obsolete --host $HOST --db $DB --gzip --archive="new.${PREFIX}_obsolete-mongodbdump.gz" && \
sha256sum new.${PREFIX}_obsolete-mongodbdump.gz |sed -e 's/new\.//' > new.obsolete.gz-sha256sum && \
md5sum new.${PREFIX}_obsolete-mongodbdump.gz |sed -e 's/new\.//' > new.obsolete.gz-md5sum && \
mv new.${PREFIX}_obsolete-mongodbdump.gz ${PREFIX}_obsolete-mongodbdump.gz && \
mv new.obsolete.gz-sha256sum obsolete.gz-sha256sum && \
mv new.obsolete.gz-md5sum obsolete.gz-md5sum

# Export delta of products modified in the last 24h or since last run of the script
mkdir -p delta
pushd delta/ > /dev/null
Expand Down

0 comments on commit c22fc42

Please sign in to comment.