Use @Transient on a domain property that should remain available in an object but should not be persisted. In Spring Data MongoDB, properties normally map to document fields with the same names unless @Field or @Transient specifies otherwise. section 4.2.2
The same annotation solves a practical problem with Spring Data R2DBC: marking a collection @Transient prevents R2DBC from trying to persist a relationship it does not support. In a TacoOrder, the tacos collection can hold Taco objects while tacoIds is written to the database. section 13.1.4
Listing 13.8 Adding a Taco collection to TacoOrder
@Data
public class TacoOrder {
...
@Transient
private transient List<Taco> tacos = new ArrayList<>();
public void addTaco(Taco taco) {
tacos.add(taco);
if (taco.getId() != null) {
tacoIds.add(taco.getId());
}
}
}
The TacoOrder listing puts @Transient on the tacos collection, alongside Java’s transient keyword. The addTaco() method keeps the collection and the persisted ID set in step. section 13.1.4

