michaelkryukov / mongomock_motor

Library for mocking AsyncIOMotorClient built on top of mongomock.
MIT License
94 stars 22 forks source link

New Beanie `Link` directive fails with mongomock harness #5

Closed cypherlou closed 2 years ago

cypherlou commented 2 years ago

Hey Michael, I was referred to your library by the guys at mongomock who think my issue is probably with mongomock-motor. This is the ticket I raised with them. Does this make any sense? Do you agree with them?

cypherlou commented 2 years ago

I've upgraded to the latest version (0.0.3) which seems to have fixed the issue. Sorry to hassle you.

michaelkryukov commented 2 years ago

Hey, the issue is actually valid, we don't mock attributes at the moment (but should). That's why Links don't work. Adding attributes is not that hard. Also, I noticed that the most recent version of beanie use command, which is not supported by mongomock at all. That is a separate issue.

I will take a closer look at the situation with Beanie as soon as I can.

michaelkryukov commented 2 years ago

I implemented proper attributes and limited support for command in order to not fail beanie initialization in commit: https://github.com/michaelkryukov/mongomock_motor/commit/9ac7a759680ece96de01c1112e8d8fe0b236a526

But it looks like Link doesn't work fully because of mongomock implementation of aggregation pipeline stage $lookup don't work properly with DBRef. I'm not sure where the problem comes from, I will post a comment on the issue in mongomock, but it looks like I can't do much from mongomock-motor.

Itay4 commented 1 year ago

@michaelkryukov got any idea for a workaround (maybe with patching mongomock) or we have to wait for fix on their side?