I use mongoengine 0.15.0. I have a 'Report' model. In the model definition, there is a method statement:
def check(self):
existing_object = self.__class__._get_collection().find({
'draft_id': self.draft_question_id,
'origin': self.fault_origin,
'history.0.conclusion': Conclusion.UNPROCESSED,
}, {'history.0': 1},).first()
I also want to set the read_preference option to ReadPreference.SECONDARY_PREFERRED. What should I do?