Spring Data MongoDB Cheatsheet
Spring Data MongoDB Cheatsheet
Spring Data MongoDB Cheatsheet
spring.data.mongodb.password=myfancypassword
Example:
@EnableMongoRepositories("de.codeboje.example.repos")
@DBRef : reference model in another @Id public interface UserRepository extends PagingAndSortingRepository<User, Long>{
collection private Long id; }
}
CrudRepository : adds basic CRUD methods
Query
findBy, findAllBy, followed by fieldnames joined MongoDB JSON query is passed in the parameter Pass a parameter of type Pageable and return Page
using AND, OR, etc
findFirstByCreationDate Sorting
codeboje.de