I'm new to Mongo and I'm still a little confused.
In my structure with mongoengine, I'm doing the following:
I will give the example of Continent and Countries
Document.py:
class Country (mongoengine.Document):
CountryName = Stringfield ()
class Continent (mongoengine.Document):
ContinentName = Stringfield ()
ContinentCountry = fields.ListField (fields.ReferenceField (Country,
reverse_delete_rule = CASCADE, DBRef = False))
Resource.py:
class CountryResource (resources.MongoEngineResource):
class Meta:
queryset = Country.objects.all ()
allowed_methods = ('get', 'post', 'put', 'delete') "
class ContinentResource (resources.MongoEngineResource):
ContinentCountry fields.ReferencedListField = (of = 'Football.Resource.CountryResource'
attribute = 'ContinentCountry', full = True, null = True)
class Meta:
queryset = Continent.objects.all ()
allowed_methods = ('get', 'post', 'put', 'delete')
But my problem is that when I consult the parents also wanted to know what continent it, and do not know how to do? I can not make a reference as I am doing.
Someone can help me?
What I'm doing is done right?
Is working, and when I refer to the continent the countries it behind me, now I will consult the parents he did not tell me the continent.
I made myself clear?