'Ensure cascading deletion of referring documents from the database.'

def test_reference_field_find(self):

    class BlogPost(Document, ):
        content = StringField()
        author = ReferenceField(self.Person)
    BlogPost.drop_collection()
    self.Person.drop_collection()
    me = self.Person(name='Test    User').save()
    BlogPost(content='test    123', author=me).save()
    self.assertEqual(1, BlogPost.objects(author=me).count())
    self.assertEqual(1, BlogPost.objects(author=me.pk).count())
    self.assertEqual(1, BlogPost.objects(author=('%s' % me.pk)).count())
    self.assertEqual(1, BlogPost.objects(author__in=[me]).count())
    self.assertEqual(1, BlogPost.objects(author__in=[me.pk]).count())
    self.assertEqual(1, BlogPost.objects(author__in=[('%s' % me.pk)]).count())
