Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
add :: ArticleRepository.java
Browse files Browse the repository at this point in the history
repository 생성 및 검색 기능의 mongo pipeline 작성
  • Loading branch information
ori0o0p committed Apr 16, 2024
1 parent 96499f9 commit 9929861
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.daemawiki.domain.article.repository;

import org.daemawiki.domain.article.model.Article;
import org.springframework.data.mongodb.repository.Aggregation;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import reactor.core.publisher.Flux;

public interface ArticleRepository extends ReactiveMongoRepository<Article, String> {
@Aggregation(pipeline = {
"{ $match: { $or: [ " +
"{ 'title': { $regex: '?0', $options: 'i' } }, " +
"{ 'contents': { $regex: '?0', $options: 'i' } }" +
"] } }"
})
Flux<Article> search(String keyword);

}

0 comments on commit 9929861

Please sign in to comment.