Document for sync and async #394
-
Why beanie using different from beanie.sync import Document
class Product(Document):
name: str
price: float from beanie import Document
class Product(Document):
name: str
price: float For example if I provide a library with defined documents structure and this library is used by sync and async projects, then I have to duplicate the code to support both? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi, Because methods have the name but different interfaces there (sync and async respectively). It will probably be implemented in I would suggest or implement a factory for your lib or use code duplication. |
Beta Was this translation helpful? Give feedback.
Hi,
Because methods have the name but different interfaces there (sync and async respectively).
It will probably be implemented in
2.0
as a single factory class, that will produce instances with different interfaces based on configs or context. But the amount of work to do so is not even estimated yet. I hope I'll implement 2.0 by New Year, but this date can be changed.I would suggest or implement a factory for your lib or use code duplication.