mongorepository spring boot custom query code example
Example 1: mongorepository spring boot custom query
public interface PersonRepository extends MongoRepository
// Geo-spatial repository queries
// { 'location' : { '$near' : [point.x, point.y], '$maxDistance' : distance}}
List findByLocationNear(Point location, Distance distance);
}
Example 2: mongorepository spring boot custom query
public interface PersonRepository extends PagingAndSortingRepository {
List findByLastname(String lastname);
Page findByFirstname(String firstname, Pageable pageable);
Person findByShippingAddresses(Address address);
}