You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found switch_db functionality really handy and decided to tried it out this weekend. The problem is that it seems ReferenceFields are not properly resolved while in switch_db context. Here is what I've tried so far:
The assertion fails as route.agency returns a Dbref. However, if I remove completely swith_db and setup the initial database as self.db_name(), everything works as expected.
Apparently that's not the focus of MongoEngine. I just don't understand why it provides a feature such as switch_db when it does not work properly with dereferencing. Please, correct me if I'm wrong, but the main reason people use MongoEngine is because of dereferencing. Otherwise, the use of straight up PyMongo would be a more suitable option I suppose.
I found
switch_db
functionality really handy and decided to tried it out this weekend. The problem is that it seemsReferenceField
s are not properly resolved while inswitch_db
context. Here is what I've tried so far:The assertion fails as
route.agency
returns aDbref
. However, if I remove completelyswith_db
and setup the initial database asself.db_name()
, everything works as expected.I even tried several other cases, with and without
select_related()
. No luck.The text was updated successfully, but these errors were encountered: