未急切获取 DBRefs(Mongo 文档引用)

我在最简单的化身中使用 Mongo(结合 Spring Data).

I am using Mongo in its simplest avatar possible (in conjunction with Spring Data).

我有两个(第一类)实体 (@Documents) A 和 B,其中 A 在其中包含 B 的引用 (@DBRef).创建 A 和 B 时一切正常.但是,当读取对象 A(按 Id)时,引用 B 始终为 null.

I have two (first class) entities (@Documents) A and B, where A has a reference (@DBRef) of B within it. Everything works fine when creating A and B. However, when reading object A (by Id), the reference B is always null.

我相信默认情况下会急切获取 DBRefs(请参阅 http://static.springsource.org/spring-data/data-document/docs/current/reference/html/#mapping-usage-references),但目前的行为是反对.任何想法为什么?

I believe DBRefs are eagerly fetched by default (see http://static.springsource.org/spring-data/data-document/docs/current/reference/html/#mapping-usage-references), but the behavior currently is against that. Any ideas why?

推荐答案

迁移到 Spring Data Mongo M5 构建解决了这个问题.所以,在那之前一定是个bug.

Moving over to the Spring Data Mongo M5 build resolved this. So, must be a bug until then.

相关文章