Reputation: 868
When Mongoengine rebuild(update) a information about indexes? I mean, if a added or change some field (added uniques or sparse option to filed) or added some meta info in model declaration. So question is:
Upvotes: 3
Views: 470
Reputation: 868
Mongoengine do not rebuild index automaticly. Mongoengine track changes in models (btw dont work if you add sparse
to your filed(if field dont have unique
options)) and then fire the ensureIndex
in mongoDB. But when its fire - make sure you delete oldest index version manualy(Mongoengine doesn't) in mongoDB.
The problem is:
sparse
to filed w.o unique
option - this changes dont mapped in mongoDB index. You need to combine unique = True, sparse = True
Upvotes: 1