mongomock_motor
mongomock_motor copied to clipboard
The fetch_links=True in beanie queries doesn't work
So after getting a document calling fetch_all_links() works however when using the keyword argument it doesn't. Thus you can't do queries comparing the linked document properties. For example the below would not work:
doc = await House.find_one(House.front_door.color == 'Blue', fetch_links=True)
This looks like same issue with mongomock's implementation of DBRef (which is the core of beanie's links) as discussed in #5. I've created issue at mongomock (mongomock/mongomock#759), but I don't really want to patch internals of mongomock in this library. So currently support for links is limited.
Thanks so much! In the interim, I changed my code to use fetch_all_links in an async for loop and for cases where I need to use fetch_links I skipped these unit tests for now. I have integration tests to cover these cases. However it would be great to have this working.
Hello, Can you fix this? it shows NotImplementedError: Although 'pipeline' is a valid lookup operator for the aggregation pipeline, it is currently not implemented in Mongomock.
What exactly is not working for you? This issue refers to the internal implemetation of beanie that doesn't support some operations with DBRef
that mongo supports (and beanie uses).