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

MongoSearcher - preserve indexes on truncate #406

Merged

Conversation

codespill
Copy link
Contributor

Description

When truncating MongoDB, collections are dropped, therefore all indexes are lost.
This pull request propose using remove() method instead of drop(), which will remove all documents whilst preserving indexes.

Additional info

Documentation on remove() method:

To delete all documents in a collection, pass an empty document ({}).

Source: https://docs.mongodb.com/manual/reference/method/db.collection.remove/

@glensc glensc added this to the Next milestone Dec 26, 2020
@glensc glensc force-pushed the mongo-searcher-preserve-indexes-on-truncate branch from 6fc1be3 to ad1b68c Compare December 26, 2020 06:49
@glensc
Copy link
Contributor

glensc commented Dec 26, 2020

Squashed fixup commits, added helper to remove duplication in tests. LGTM

@glensc glensc force-pushed the mongo-searcher-preserve-indexes-on-truncate branch from ad1b68c to c7afd29 Compare December 26, 2020 06:52
@glensc glensc merged commit 937c42a into perftools:master Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants