MongoEngine/mongoengine — pull request #263 by wojcikstefan (2013-03-29 02:08:56+00:00)
Title: Case insensitive uniqueness

```
from mongoengine import *

connect('dbname')

class A(Document):
b = StringField(unique_case_insensitive=True)

c = A()
c.b = 'whatever'
c.save()

d = A()
d.b = 'WhatEVER'
d.save()
```

results in:

```
(env)[mongoengine] python test.py 19:00:59 git:(master*)
Traceback (most recent call last):
File "test.py", line 11, in
c.save()
File "/Users/wojcikstefan/Repos/mongoengine/mongoengine/document.py", line 266, in save
raise NotUniqueError(message % unicode(err))
mongoengine.queryset.NotUniqueError: Tried to save duplicate unique keys (E11000 duplicate key error index: tumblelog.a.$_b_lower_1 dup key: { : "whatever" })
```