MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / test_sparse_field

Method test_sparse_field

tests/fields/test_fields.py:2247–2253  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2245 assert Animal.objects(_cls__in=["Animal.Fish.Guppy"]).count() == 0
2246
2247 def test_sparse_field(self):
2248 class Doc(Document):
2249 name = StringField(required=False, unique=True, sparse=True)
2250
2251 # This would raise an exception in a non-sparse unique index
2252 Doc().save()
2253 Doc().save()
2254
2255 def test_undefined_field_exception(self):
2256 """Tests if a `FieldDoesNotExist` exception is raised when

Callers

nothing calls this directly

Calls 2

DocClass · 0.70
saveMethod · 0.45

Tested by

no test coverage detected