可以使用@DBRef注释将引用的类持久化到单独的集合中,否则该文档将持久化到同一个文档(json)中.
从spring data documentation
@DBRef - applied at the field to indicate it is to be stored using a com.mongodb.DBRef.
7.3.4 Using DBRefs
The mapping framework doesn't have to store child objects embedded within the document. You can also store them separately and use a DBRef to refer to that document. When the object is loaded from MongoDB, those references will be eagerly resolved and you will get back a mapped object that looks the same as if it had been stored embedded within your master document.