Two questions:
- If I delete all the data inside the collection (db.mycollection.remove ({})) will the indexing information that I created earlier be lost?
- How often (how many more records should I have) should I recreate the index?
source shareCalling remove() will remove the indexed data, but not the indexes themselves (this will drop the collection). Therefore, when you insert new documents, they will be added to the indexes created before the remove() call.
You do not need to recreate the index. After creating the index, it will be automatically updated as documents are inserted / updated / deleted.
source shareSource: https://habr.com/ru/post/1308509/
All Articles