Reputation: 1037
Let's say we have four fields in a Java domain object.
Instead of mapping all fields into the MongoDB document, are there ways to selectively map three fields to the MongoDB?
public class Person {
@Id
private String id;
private String name;
// we don't want to map this field into MongoDB
private String noMongoDB.
// getters and setters
}
Upvotes: 1
Views: 396
Reputation: 121507
org.springframework.data.annotation.Transient
is for you.
The same premise as it is with the same annotation from JPA.
public class Person {
@Id
private String id;
private String name;
@Transient
private String noMongoDB.
}
Upvotes: 5