@Query(value = "{$and:[{'contentRoot.basicData.code':{$ne:null}}" +
",{'contentRoot.basicData.tourOperatorCode':{$ne:null}}]}"
,fields = "{$and: [{productCode: 1, tourOperatorCode: 1}]}")
I try to get 3 Documents from Mongodb. I don´t know where can i use {$limit: 3}, or alternative command.
2
Answers
You can use it at the end of the query.
Or you can use the @Aggregation annotation
read this for more details.
https://stackoverflow.com/a/71292598/8470055
You can provide
Pageable
as query method parameterAnd init
Pageable
this way: