Scille / umongo

sync/async MongoDB ODM, yes.
MIT License
448 stars 63 forks source link

Improve Motor GenericReference field #352

Open molten-firescar96 opened 3 years ago

molten-firescar96 commented 3 years ago

I got a NotImpletemented exception when using .fetch on a generic reference field. This commit fixes the problem. I have a workaround, by declaring the reference_cls attribute explicitly in my own code, GenericReferenceField(reference_cls=MotorAsyncIOReference), but it seemed like a change I should submit upstream.

I noticed a related issue https://github.com/Scille/umongo/issues/349, so I'm trying to make this commit compatible.

What do you think?

lafrech commented 3 years ago

Sorry about the delay.

I agree with this change. I pushed a branch where I tried this on Reference field (to fix #349 @richiq) and I'm happy with it.

https://github.com/Scille/umongo/tree/reference_cls

Do you think you could rework your PR to include those changes and add unit tests?