Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Load products in mongodb #11072

Merged
merged 4 commits into from
Nov 29, 2024
Merged

fix: Load products in mongodb #11072

merged 4 commits into from
Nov 29, 2024

Conversation

stephanegigandet
Copy link
Contributor

@stephanegigandet stephanegigandet commented Nov 29, 2024

Script used to refresh products in MongoDB, following the bug that created OFF pro products on the OFF mongodb database:
#11064

 2014  mongoexport --host 10.1.0.102 --db=off --collection=products --query='{"$expr": {"$ne":["$_id","$id"]},"data_sources_tags":"producers"}' --fields=_id > off-pro-products-on-off.json

 2027  mongoexport --host 10.1.0.102 --db=off --collection=products_obsolete --query='{"$expr": {"$ne":["$_id","$id"]},"data_sources_tags":"producers"}' --fields=_id > off-pro-products-on-off.obsolete.json
 2028  vi off-pro-products-on-off.obsolete.json

 2029  ./scripts/load_products_in_mongodb.pl --product off-pro-products-on-off.obsolete.json 

 2030  ./scripts/load_products_in_mongodb.pl --product scripts/off-pro-products-on-off.json 

Removed products from off database:

test> use off
switched to db off
off> db.products.count({"$expr": { "$ne": ["$_id", "$id"]}, "data_sources_tags": "producers"}, {"_id" : 1})
6738
off> db.products.remove({"$expr": { "$ne": ["$_id", "$id"]}, "data_sources_tags": "producers"}, {"_id" : 1})
DeprecationWarning: Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite.
{ acknowledged: true, deletedCount: 6738 }

off> db.products_obsolete.remove({"$expr": { "$ne": ["$_id", "$id"]}, "data_sources_tags": "producers"}, {"_id" : 1})
{ acknowledged: true, deletedCount: 201 }

Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexgarel alexgarel enabled auto-merge (squash) November 29, 2024 18:30
Copy link

sonarcloud bot commented Nov 29, 2024

@alexgarel alexgarel merged commit 6787ba1 into main Nov 29, 2024
14 checks passed
@alexgarel alexgarel deleted the load_products_in_mongodb branch November 29, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants