Is there a way to achieve @Id
and @Field
on the same variable of a @Document
so the variable is also saved inside the document? I'm trying to preserve the data I'm importing as much as I can, even though I get the design practices followed by the developers.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The @Id annotation will take priority over @Field, so no the id cannot be persisted as both document ID and value inside the document. Quickest way to achieve that is probably to duplicate the id field as a separate @Field annotated attribute?