开发者

Mongodb and indexing

Two questions:

  • If I remove all the data ins开发者_C百科ide a collection (db.mycollection.remove({})) will the indexing information I created previously be lost?
  • How often (how many more entries must I have) should I recreate the index?


  1. Calling remove() will remove the indexed data but not the indexes themselves (dropping a collection will do that). So when you insert new documents they will be added to the indexes you created prior to the remove() call.

  2. You don't need to recreate the index. Once you've created an index it will automatically be updated as documents are inserted / updated / removed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜