Member.class
@Document(collection = "alfagift_member")
public class Member {
@Field(value = "full_name")
private String fullName;
@Field(value = "member_id")
private String memberId;
@Field(value = "pin")
private Pin pin;
}
Pin.class
public class Pin {
@Field(value = "encrypted_value")
private String encryptedValue;
@Field(value = "last_blocked")
private Date lastBlocked;
}
MemberRepository.class
@Repository
public interface MemberRepository extends MongoRepository<Member, String> {
@Query(value="{'member_id' : ?0}, {'pin.last_blocked' : ?1}")
Member findByMemberIdAndLastBlockedGreaterThan(Integer memberId, Date now);
}
Затем я попытался сделать такой метод запроса, но сама функция больше не работает
Я запутался, как решить ??
** EDITT
Данные в MongoDB
{
"_id": ObjectId("5f1fa9876b911d2b27d0bcf5"),
"full_name": "this is my name",
"pin": {
"encrypted_value": "e9b0d0aae93291679b304f9d3c058029fa4253ccaf366cae3aeb473099b7aff8:qcfq9josgstqjcoun0isnvmja3",
"last_blocked": ISODate("2020-08-03T05:00:31.597Z")
},
"member_id": 2200146,
"_class": "id.alfadigital.alfagift.service.account.v1.db.mongo.domain.Member"
}
И отправка параметров
Date now = new Date(System.currentTimeMillis() - TimeUnit.HOURS.toMillis(1));
Member member = memberRepository.findByMemberIdAndLastBlockedGreaterThan(memberId, now);