Reputation: 871
I am using django-nonrel and django-mongodb engine.
In engine's documentation, it says that it supports django's Meta options.
I tried using unique_together
in a model as such:
class Bottler(models.Model):
location = models.CharField(max_length=20)
source = models.CharField(max_length=20)
transactionID = models.CharField()
class Meta:
unique_together = (("location","source"),)
However this doesn't seem to have worked since I could create duplicates without any error being raised.
I know unique_together
is enforced at the database level.
What does that translate to in MongoDB? Do I have to validate it manually?
Upvotes: 2
Views: 431
Reputation: 97
Somehow syncbd will not update your indexes in mongodb. What you can try (if possible in your situation) is to delete the collection and then run syncdb. In my case it did create the indexes then.
Upvotes: 0