0
매핑되지 않는 해시 나는 다음과 같은 수집 "플레이어"잭슨, 암호
{
"_id" : ObjectId("5426efb844ae829d1dcdaa6d"),
"username" : "Foobar",
"password" : "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33",
"gameIds" : [
"5426f10544ae8502f731d8a0"
]
}
그것은 해시 된 암호가 있습니다. 틸을 내 Player 개체로 다시 매핑하려고하면 암호를 제외한 모든 것이 매핑됩니다. 암호는 null입니다.
은이 매핑 내 플레이어입니다
@Data
@JsonRootName("player")
@NoArgsConstructor
public class Player {
@JsonIgnore
public static final String COL_NAME = "player";
@ObjectId
@Id
private String id;
/**Will use this token to authorize the user. This UUID should be cached once the user logs in */
@JsonIgnore
private UUID token = UUID.randomUUID();
@NotBlank
//Unique
private String username;
@Email
private String email;
@NotBlank
private String password;
/** Set of unique active games * */
private Set<String> gameIds = new HashSet<>();
}
이 같은 플레이어 절약 오전 :
Player player = new Player();
player.setUsername(username);
player.getGameIds().add(pbfId);
player.setPassword(DigestUtils.sha1Hex("foo"));
playerCollection.insert(player);
을 그리고 다음과 같이 읽기 :
DBCursor<Player> username = playerCollection.find(DBQuery.is("username", "Foobar"), new BasicDBObject());
Player player = username.next();
을 여기에 모든 암호는 제외 올바르게 매핑 됨
여기에 잭슨이 관련되어 있습니까? –
몽고 잭은 그것을 내부적으로 사용합니다. –