Created
April 27, 2020 07:28
-
-
Save pszalawinski/69d6f4e711a069006004f296559368b8 to your computer and use it in GitHub Desktop.
Query for MongoDB in Spring app #mongodb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.data.mongodb.repository.Query; | |
@Repository | |
public interface BookRepository extends MongoRepository<Book, Integer> { | |
@Query("{'author' : ?0}") //import org.springframework.data.mongodb.repository.Query; | |
List<Book> findByAuthor(String author); | |
} | |
// documentation: https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#mongo.repositories |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment