'Ensure that embedded documents in complex fields can reference
parent instance.'

def test_embedded_document_complex_instance(self):

    class Embedded(EmbeddedDocument, ):
        string = StringField()
    class Doc(Document, ):
        embedded_field = ListField(EmbeddedDocumentField(Embedded))
    Doc.drop_collection()
    doc = Doc(embedded_field=[Embedded(string='Hi')])
    self.assertHasInstance(doc.embedded_field[0], doc)
    doc.save()
    doc = Doc.objects.get()
    self.assertHasInstance(doc.embedded_field[0], doc)
