I would like to understand how do I compare two fields in the document. Has anyone ever needed to do this type of comparison? I'm using the criteria. criteria.add(Criteria.where("this.campoC == this.campoD")); Query query = new Query(); List criteria = new ArrayList(); criteria.add(Criteria.where("campoA").is(123)); criteria.add(Criteria.where("campoB").is("N")); criteria.add(Criteria.where("this.campoC == this.campoD")); //
In Spring Data JPA, the @Query annotation is typically used for defining custom queries for reading data from the database. While it's not intended for update operations, you can achieve update functionality using @Query in combination with the @Modifying annotation.
Thank u for video, i feel you need to explain the use case whihc you want to demo in video,then end use(group by case was not clear.
Great Work 👍
Please share the sample code for this tutorial.
wow u told lot many ,is there any complete list of when to use which, i felt it is small lecture, can u do big detailed lecture
Sure
thanku
Increase your volume please
I would like to understand how do I compare two fields in the document. Has anyone ever needed to do this type of comparison? I'm using the criteria.
criteria.add(Criteria.where("this.campoC == this.campoD"));
Query query = new Query();
List criteria = new ArrayList();
criteria.add(Criteria.where("campoA").is(123));
criteria.add(Criteria.where("campoB").is("N"));
criteria.add(Criteria.where("this.campoC == this.campoD")); //
@GetMapping("/")
List compareName(@PathVariable(value = "name") String name,@PathVariable(value = "name2") String name2){
Query query = new Query();
query.addCriteria(Criteria.where(name).elemMatch(Criteria.where(name)));
return mongoTemplate.find(query,EmployeeModel.class);
}
Haven't seen any criteria queries...
How to write case insensitive query
Can you please add this code into GitHub
where is github link?
Can we use @Query for update also ??
In Spring Data JPA, the @Query annotation is typically used for defining custom queries for reading data from the database. While it's not intended for update operations, you can achieve update functionality using @Query in combination with the @Modifying annotation.
explain update query