'Ensure that distinct resolves field name to db_field as expected.'

def test_distinct_handles_db_field(self):

    class Product(Document, ):
        product_id = IntField(db_field='pid')
    Product.drop_collection()
    Product(product_id=1).save()
    Product(product_id=2).save()
    Product(product_id=1).save()
    self.assertEqual(set(Product.objects.distinct('product_id')), set([1, 2]))
    self.assertEqual(set(Product.objects.distinct('pid')), set([1, 2]))
    Product.drop_collection()
