art049 / odmantic

Sync and Async ODM (Object Document Mapper) for MongoDB based on python type hints
http://art049.github.io/odmantic
ISC License
1.04k stars 94 forks source link

Motor `get_database` method kwargs support #70

Open Olegt0rr opened 3 years ago

Olegt0rr commented 3 years ago

Motor supports additional options for databases

def get_database(self, name=None, codec_options=None, read_preference=None,
                     write_concern=None, read_concern=None):
    ...

I always use feature with setting read_preference=ReadPreference.SECONDARY_PREFERRED. It's really helps with highload apps.

Why don't you pass this options to AIOEngine init?

art049 commented 3 years ago

Thanks, yes support of additional preferences was totally planned. It should be included as well in the find/save method as well but setting it globally on the engine first is totally ok to me !