I am trying to retrieve the id from the child document based on a condition of one of its fields . Here are the document schemas.
class father(DynamicDocument):
name = StringField
class child(DynamicDocument):
name = StringField
parent = ReferenceField('father')
How can I get the id of the child where its father's name is 'Anakin'?
I am trying with this query:
Child.objects.filter(parent__name=Father.objects(name='Anakin').first().id).first().id
But it results to:
mongoengine.errors.InvalidQueryError: Cannot perform join in mongoDB: parent__name