【发布时间】:2016-01-20 08:24:52
【问题描述】:
我在下面有一个示例类,但是当我运行 manage.py syncdb 时,没有创建下面的索引。互联网上也有很多混乱,我想知道我应该使用“Meta”还是“MongoMeta”(两者都试过)。
使用 mongodb 在 Django-nonrel 中允许自动创建索引的正确方法是什么
类项目(models.Model): xxx xxx . .
class MongoMeta:
unique_together = [("CountryRetailer", "ProductId")]
indexes = [
[('CountryRetailer',1)],
[('ProductId',1)],
[('OnlineRetailerName',1)],
[('UniqueKey', 1)],
[('Type',1), ('PriceValue',1)],
[('CreatedOn', -1)]
【问题讨论】:
标签: mongodb indexing django-nonrel