Delete N1QL query is deleting all documents instead of deleting only documents that matches the criteria

I have a simple requirement to delete all documents whose date is less than specified in the query. but whatever option I try, it’s deleting all documents from db. Code is written in Java Spring Boot project.
Sprinboot-2.4.4. spring data couchbase-4.1.6
sample codes I tried: I tried passing argument as String, LocalDateTime, etc but none of it worked.

@Query("#{#n1ql.delete} WHERE #{#n1ql.filter} AND dateParam < MILLIS($1)")
void selectDateTime(LocalDateTime/String dateParam);

@Query("#{#n1ql.delete} WHERE #{#n1ql.filter} AND dateParam < $1")
void selectDateTime(String dateParam);

@Query("#{#n1ql.delete} WHERE #{#n1ql.filter} AND dateParam < MILLIS($1) #{#n1ql.returning}")
List selectDateTime(String dateParam);

dateParam passed as String was: “2021-04-07T06:47:32Z”
I also tried passing LocalDateTime- LocalDateTime.of(2021, 4, 7, 06, 47, 32);

To Test, I tried select query and correct number of documents matching criteria is returned in this case.

@Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter} AND syncTimeStamp < MILLIS($1)")
void selectDateTime(LocalDateTime/String date);

It’s surprising it’s working for select query but not for delete query.

If I run query from couchbase UI, only documents that matches condition gets deleted.

delete from DB_NAME where dateParam < 1618188052352

note: date is given in epoch format.

Any help would be appreciated.