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 ({}).
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:
Source: https://docs.mongodb.com/manual/reference/method/db.collection.remove/