PyMongo create unique index with 2 or more fields

Viewed 21852

How can i create index in pymongo with 2 fields, to be unique together?

I have this code:

self.db[self.mongo_collection].create_index("url", unique=True)

but i need to be unique with url and category.

1 Answers
Related