Question

I'm a newbie for django and mongoengine.. so I'm not sure my code is correct on this issue..

class Example(Document):
    member = ReferenceField(Members)

query = Example.objects().select_related(max_depth=0) should not query variable have member field? so that when I code

query.member.name ---> None

but the result would be the member's name like Simson..

In my real application, I don't want to use dereference.. even though the class(Document) has ReferenceField nor I want to use "only()", "exclude" methods..

How can I make mongoengine not use dereference even though the class(Document) has its own ReferenceField?

(I just implemented ReferenceField for the future so as to use it one day.. but not now)

Was it helpful?

Solution

Interestingly, it was never intended not to dereference - so you can't turn this off at the moment. I've kept your ticket open as I could add a flag to make this lazy, in 0.7 we are looking at how best to make MongoEngine highly performant and this looks like one area that can be improved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top