我有一个带有getter和setter以及一些属性的简单bean,我想不使用spring-data-mongodb将属性值保存到MongoDB中
示例请求正文:
class Person
{
public Person(){}
public Person(String a , String b)
{
this.accountId = a;
this.creditCardNo = b; //This should not be saved
}
private String accountId;
@Transient //Spring-data transient
private transient String creditCardNo; //This should not be saved into db
/* Getter and Setter methods go here */
}
/* After some validations */
Person p = new Person("xxx","yyy");
mongoTemplate.save(p); //Saves xxx and yyy BUT xxx must have been saved and yyy is transient should NOT BE SAVED.
班级人员:
{{1}}