LazyReferenceField和ReferenceField Mongoengine有什么区别?

2024-04-26 03:17:35 发布

您现在位置:Python中文网/ 问答频道 /正文

docsLazyReferenceField中:

A really lazy reference to a document. Unlike the ReferenceField it will not be automatically (lazily) dereferenced on access. Instead, access will return a LazyReference class instance, allowing access to pk or manual dereference by using fetch() method.

我知道在性能方面有差异,但我不明白为什么?我应该总是用LazyReferenceField而不是ReferenceField吗?或者有不同的用例?你知道吗


Tags: thetoaccessnotitbedocumentwill