Reputation: 2023
I have the below object
@Document(collection = "qr_code")
public class QrCode implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String qrCodeId;
@Field
private String codePay;
private LocalDateTime expiredIn;
}
I have this query to check if a codePay
exists or not
boolean existsByCodePay(String codePay);
I want another query to check if a QrCode
is expired or not, based on attribute expiredIn
, that's to say the QrCode
expired when expiredIn < LocalDateTime.now()
@Query(???)
boolean isQrCodeExpired(String codePay);
Upvotes: 0
Views: 420
Reputation: 720
The raw mongodb query can be something like this :
{
"expiredIn":{
$gt : new Date()
}
}
Upvotes: 1