Skip to content

Commit

Permalink
1029 delete specific indexes contribution collection (#1032)
Browse files Browse the repository at this point in the history
* drop old indexes from list

* updated changelog
  • Loading branch information
minump authored Nov 1, 2022
1 parent 3966131 commit 0f50179
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Arrange environment variables and data deletion endpoint into single row in capability. [#989](https://github.com/rokwire/rokwire-building-blocks-api/issues/989)
- API Doc Dockerfile URLs to include new building blocks and remove unsupported building blocks. [#831](https://github.com/rokwire/rokwire-building-blocks-api/issues/831)
- Talent fields yaml configuration [#949](https://github.com/rokwire/rokwire-building-blocks-api/issues/949)
- Drop old indexes in contributions collection in mongodb. [#1029](https://github.com/rokwire/rokwire-building-blocks-api/issues/1029)

### Fixed
- Fix Core BB service token support in events [#994](https://github.com/rokwire/rokwire-building-blocks-api/issues/994)
Expand Down
4 changes: 2 additions & 2 deletions contributions/api/utils/mongoutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
coll_contribution = db_contribution[cfg.CONTRIBUTION_COLL_NAME] # set contribution collection
# drop old indexes in contribution collection
coll_contribution_indexes = coll_contribution.index_information().keys()
# get all indexes except id and text index
coll_contribution_old_indexes = [index for index in coll_contribution_indexes if index not in ['_id_', 'text_index']]
# get old indexes
coll_contribution_old_indexes = [index for index in coll_contribution_indexes if index in ['name', 'capabilities.name', 'talents.name']]
for index_name in coll_contribution_old_indexes:
coll_contribution.drop_index(index_name)
# create compound text indexes with equal weightage
Expand Down

0 comments on commit 0f50179

Please sign in to comment.