Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87ab1ac48c | ||
|
|
454afd9877 | ||
|
|
45971b212c | ||
|
|
68370c16fb | ||
|
|
d2c9b47366 | ||
|
|
4d7ee0e741 | ||
|
|
e7f3a2436d |
6
pom.xml
6
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>3.3.0-M1</version>
|
||||
<version>3.3.0-M2</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Spring Data MongoDB</name>
|
||||
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-parent</artifactId>
|
||||
<version>2.6.0-M1</version>
|
||||
<version>2.6.0-M2</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
@@ -26,7 +26,7 @@
|
||||
<properties>
|
||||
<project.type>multi</project.type>
|
||||
<dist.id>spring-data-mongodb</dist.id>
|
||||
<springdata.commons>2.6.0-M1</springdata.commons>
|
||||
<springdata.commons>2.6.0-M2</springdata.commons>
|
||||
<mongo>4.3.0</mongo>
|
||||
<mongo.reactivestreams>${mongo}</mongo.reactivestreams>
|
||||
<jmh.version>1.19</jmh.version>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>3.3.0-M1</version>
|
||||
<version>3.3.0-M2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>3.3.0-M1</version>
|
||||
<version>3.3.0-M2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||
<version>3.3.0-M1</version>
|
||||
<version>3.3.0-M2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -177,16 +177,6 @@ public abstract class QuerydslAbstractMongodbQuery<K, Q extends QuerydslAbstract
|
||||
return serializer.toSort(orderSpecifiers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual {@link QueryMixin} delegate.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
QueryMixin<Q> getQueryMixin() {
|
||||
return queryMixin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the {@literal Mongo Shell} representation of the query. <br />
|
||||
* The following query
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.data.mongodb.repository.query.MongoEntityInformation;
|
||||
import org.springframework.data.querydsl.EntityPathResolver;
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
import org.springframework.data.querydsl.SimpleEntityPathResolver;
|
||||
import org.springframework.data.repository.support.PageableExecutionUtils;
|
||||
import org.springframework.data.support.PageableExecutionUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.querydsl.core.NonUniqueResultException;
|
||||
@@ -212,6 +212,10 @@ public class QuerydslMongoPredicateExecutor<T> extends QuerydslPredicateExecutor
|
||||
*/
|
||||
private SpringDataMongodbQuery<T> applyPagination(SpringDataMongodbQuery<T> query, Pageable pageable) {
|
||||
|
||||
if (pageable.isUnpaged()) {
|
||||
return query;
|
||||
}
|
||||
|
||||
query = query.offset(pageable.getOffset()).limit(pageable.getPageSize());
|
||||
return applySorting(query, pageable.getSort());
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.query.MongoEntityInformation;
|
||||
import org.springframework.data.repository.support.PageableExecutionUtils;
|
||||
import org.springframework.data.support.PageableExecutionUtils;
|
||||
import org.springframework.data.util.StreamUtils;
|
||||
import org.springframework.data.util.Streamable;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
@@ -139,9 +139,4 @@ abstract class SpringDataMongodbQuerySupport<Q extends SpringDataMongodbQuerySup
|
||||
protected Document createSort(List<OrderSpecifier<?>> orderSpecifiers) {
|
||||
return serializer.toSort(orderSpecifiers);
|
||||
}
|
||||
|
||||
// TODO: Remove once https://github.com/querydsl/querydsl/pull/2916 is merged
|
||||
QueryMixin<Q> getQueryMixin() {
|
||||
return superQueryMixin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
import org.springframework.dao.PermissionDeniedDataAccessException;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.data.mongodb.MongoDatabaseFactory;
|
||||
@@ -122,6 +124,20 @@ public class QuerydslMongoPredicateExecutorIntegrationTests {
|
||||
.containsExactly(dave);
|
||||
}
|
||||
|
||||
@Test // GH-3751
|
||||
public void findPage() {
|
||||
|
||||
assertThat(repository
|
||||
.findAll(person.lastname.startsWith(oliver.getLastname()).and(person.firstname.startsWith(dave.getFirstname())),
|
||||
PageRequest.of(0, 10))
|
||||
.getContent()).containsExactly(dave);
|
||||
|
||||
assertThat(repository
|
||||
.findAll(person.lastname.startsWith(oliver.getLastname()).and(person.firstname.startsWith(dave.getFirstname())),
|
||||
Pageable.unpaged())
|
||||
.getContent()).containsExactly(dave);
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-362, DATAMONGO-1848
|
||||
public void springDataMongodbQueryShouldAllowJoinOnDBref() {
|
||||
|
||||
|
||||
@@ -30,10 +30,11 @@ import java.util.UUID;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.ExampleMatcher.*;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.mongodb.MongoTransactionManager;
|
||||
import org.springframework.data.mongodb.core.geo.GeoJsonPoint;
|
||||
@@ -177,6 +178,19 @@ class SimpleMongoRepositoryTests {
|
||||
assertThat(result.getTotalPages()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test // GH-3751
|
||||
void findByExampleShouldReturnUnpagedResults() {
|
||||
|
||||
Person sample = new Person();
|
||||
sample.setLastname("Matthews");
|
||||
trimDomainType(sample, "id", "createdAt", "email");
|
||||
|
||||
Page<Person> result = repository.findAll(Example.of(sample), Pageable.unpaged());
|
||||
|
||||
assertThat(result.getContent()).hasSize(2).contains(dave, oliver);
|
||||
assertThat(result.getTotalPages()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1464
|
||||
void findByExampleMultiplePagesShouldLookUpEntriesCorrectly() {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Spring Data MongoDB 3.3 M1 (2021.1.0)
|
||||
Spring Data MongoDB 3.3 M2 (2021.1.0)
|
||||
Copyright (c) [2010-2019] Pivotal Software, Inc.
|
||||
|
||||
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||
@@ -27,4 +27,5 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user