DATAMONGO-2374 - Polishing.

Reformat code.

Original pull request: #791.
This commit is contained in:
Mark Paluch
2019-09-19 14:15:46 +02:00
parent bc29f2b24e
commit dc859953f4
4 changed files with 8 additions and 9 deletions

View File

@@ -68,7 +68,7 @@ class PropertyOperations {
} else { } else {
MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(targetType); MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(targetType);
if(entity != null) { if (entity != null) {
entity.doWithProperties( entity.doWithProperties(
(SimplePropertyHandler) persistentProperty -> projectedFields.append(persistentProperty.getName(), 1)); (SimplePropertyHandler) persistentProperty -> projectedFields.append(persistentProperty.getName(), 1));
} }

View File

@@ -36,8 +36,6 @@ import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import com.mongodb.client.result.DeleteResult;
/** /**
* Set of classes to contain query execution strategies. Depending (mostly) on the return type of a * Set of classes to contain query execution strategies. Depending (mostly) on the return type of a
* {@link org.springframework.data.repository.query.QueryMethod} a {@link AbstractReactiveMongoQuery} can be executed in * {@link org.springframework.data.repository.query.QueryMethod} a {@link AbstractReactiveMongoQuery} can be executed in
@@ -174,7 +172,7 @@ interface ReactiveMongoQueryExecution {
return source; return source;
} }
if(!operations.getConverter().getMappingContext().hasPersistentEntityFor(returnedType.getReturnedType())) { if (!operations.getConverter().getMappingContext().hasPersistentEntityFor(returnedType.getReturnedType())) {
return source; return source;
} }

View File

@@ -360,9 +360,10 @@ public interface PersonRepository extends MongoRepository<Person, String>, Query
@Query(value = "{ 'id' : ?0 }", fields = "{ 'fans': { '$slice': [ ?1, ?2 ] } }") @Query(value = "{ 'id' : ?0 }", fields = "{ 'fans': { '$slice': [ ?1, ?2 ] } }")
Person findWithSliceInProjection(String id, int skip, int limit); Person findWithSliceInProjection(String id, int skip, int limit);
@Query(value = "{ 'shippingAddresses' : { '$elemMatch' : { 'city' : { '$eq' : 'lnz' } } } }", fields = "{ 'shippingAddresses.$': ?0 }") @Query(value = "{ 'shippingAddresses' : { '$elemMatch' : { 'city' : { '$eq' : 'lnz' } } } }",
fields = "{ 'shippingAddresses.$': ?0 }")
Person findWithArrayPositionInProjection(int position); Person findWithArrayPositionInProjection(int position);
@Query(value="{_id:?0}") @Query(value = "{_id:?0}")
Optional<org.bson.Document> findDocumentById(String id); Optional<org.bson.Document> findDocumentById(String id);
} }

View File

@@ -281,9 +281,9 @@ public class ReactiveMongoRepositoryTests implements BeanClassLoaderAware, BeanF
repository.findByLocationNear(new Point(-73.99, 40.73), // repository.findByLocationNear(new Point(-73.99, 40.73), //
new Distance(2000, Metrics.KILOMETERS)).as(StepVerifier::create).consumeNextWith(actual -> { new Distance(2000, Metrics.KILOMETERS)).as(StepVerifier::create).consumeNextWith(actual -> {
assertThat(actual.getDistance().getValue()).isCloseTo(1, offset(1d)); assertThat(actual.getDistance().getValue()).isCloseTo(1, offset(1d));
assertThat(actual.getContent()).isEqualTo(dave); assertThat(actual.getContent()).isEqualTo(dave);
}).verifyComplete(); }).verifyComplete();
} }
@Test // DATAMONGO-1444 @Test // DATAMONGO-1444