Will Syncdb use Meta or MongoMeta on Django-nonrel/mongodb Models?

101 Views Asked by At

I have a sample class below, but when i run manage.py syncdb, none of the index below gets created. There is also a whole load of confusion in the internet that i wonder if i should be using "Meta" or "MongoMeta" (tried both).

What is the proper way to allow automatic index creation in Django-nonrel with mongodb

class Item (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)]
1

There are 1 best solutions below

0
Kristiyan Gospodinov On

You have to add django_mongodb_engine in INSTALLED_APPS to make it work.