Switch collection in mongoengine for find query
问题 I've read mongoengine documentation about switching collection to save document. And test this code and it worked successfully: from mongoengine.context_managers import switch_db class Group(Document): name = StringField() Group(name="test").save() # Saves in the default db with switch_collection(Group, 'group2000') as Group: Group(name="hello Group 2000 collection!").save() # Saves in group2000 collection But the problem is when I want to find saved document in switch collection switch