|
19 | 19 | import java.util.List;
|
20 | 20 | import java.util.Set;
|
21 | 21 |
|
| 22 | +import org.springframework.data.domain.Example; |
22 | 23 | import org.springframework.data.geo.GeoResults;
|
23 | 24 | import org.springframework.data.mongodb.core.BulkOperations.BulkMode;
|
24 | 25 | import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
|
56 | 57 | * @author Chuong Ngo
|
57 | 58 | * @author Christoph Strobl
|
58 | 59 | * @author Thomas Darimont
|
| 60 | + * @author Mark Paluch |
59 | 61 | */
|
60 | 62 | public interface MongoOperations {
|
61 | 63 |
|
@@ -628,6 +630,36 @@ <T> MapReduceResults<T> mapReduce(Query query, String inputCollectionName, Strin
|
628 | 630 | */
|
629 | 631 | <T> T findById(Object id, Class<T> entityClass, String collectionName);
|
630 | 632 |
|
| 633 | + /** |
| 634 | + * Map the results of a Query-by-Example query onto the given {@code probe} class. The collection is determined from the {@code probe} type. |
| 635 | + * <p/> |
| 636 | + * The objects are converted from the MongoDB native representation using an instance of {@see MongoConverter}. Unless |
| 637 | + * configured otherwise, an instance of MappingMongoConverter will be used. |
| 638 | + * <p/> |
| 639 | + * The query is constructed from the {@code probe}. |
| 640 | + * |
| 641 | + * @param probe the probe to be used for the Example, must not be {@literal null}. |
| 642 | + * @param <S> |
| 643 | + * @param <T> |
| 644 | + * @return the List of converted objects |
| 645 | + */ |
| 646 | + <S extends T, T> List<T> findByExample(S probe); |
| 647 | + |
| 648 | + /** |
| 649 | + * Map the results of a Query-by-Example query onto the given {@link Example#getProbeType()} class. The collection is determined from the {@link Example#getProbeType()}. |
| 650 | + * <p/> |
| 651 | + * The objects are converted from the MongoDB native representation using an instance of {@see MongoConverter}. Unless |
| 652 | + * configured otherwise, an instance of MappingMongoConverter will be used. |
| 653 | + * <p/> |
| 654 | + * The query is constructed from the {@link Example}. |
| 655 | + * |
| 656 | + * @param example the example, must not be {@literal null}. |
| 657 | + * @param <S> |
| 658 | + * @param <T> |
| 659 | + * @return the List of converted objects |
| 660 | + */ |
| 661 | + <S extends T, T> List<T> findByExample(Example<S> example); |
| 662 | + |
631 | 663 | /**
|
632 | 664 | * Triggers <a href="http://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/">findAndModify
|
633 | 665 | * <a/> to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query}.
|
|
0 commit comments