Skip to content

Commit

Permalink
hotfix:
Browse files Browse the repository at this point in the history
  • Loading branch information
ori0o0p committed Sep 14, 2024
1 parent 49c7ba1 commit 6031baf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.repo.whopper.infrastructure.mongo;

import org.springframework.data.mongodb.core.BulkOperations;
import org.springframework.data.mongodb.core.query.Query;

import java.util.stream.Stream;

public interface MongoUtils {
<T> Stream<T> find(Query query, Class<T> targetClass);
<T> BulkOperations bulkOps(Class<T> targetClass);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.repo.whopper.infrastructure.mongo;

import lombok.RequiredArgsConstructor;
import org.springframework.data.mongodb.core.BulkOperations;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
Expand All @@ -12,7 +13,13 @@
public class MongoUtilsImpl implements MongoUtils {
private final MongoTemplate mongoTemplate;

@Override
public <T> Stream<T> find(Query query, Class<T> targetClass) {
return mongoTemplate.find(query, targetClass).stream();
}

@Override
public <T> BulkOperations bulkOps(Class<T> targetClass) {
return mongoTemplate.bulkOps(BulkOperations.BulkMode.UNORDERED, targetClass);
}
}

0 comments on commit 6031baf

Please sign in to comment.