Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
189d4dd
DATAMONGO-1514 - SpringDataMongodbQuery needs to be public.
LinkedList Oct 27, 2016
cb90bfc
DATAMONGO-1514 - Polishing.
odrotbohm Oct 27, 2016
f782338
DATAMONGO-1513 - Fixed identifier population for event listener gener…
odrotbohm Oct 30, 2016
9c20da3
DATAMONGO-1504 - Assert compatibility with MongoDB 3.4.
christophstrobl Oct 5, 2016
2ae75a4
DATAMONGO-1500 - Fix JSON serialization error in derived queries with…
christophstrobl Nov 2, 2016
6a9823f
DATAMONGO-1521 - Added Aggregation.skip(…) overload to support longs.
odrotbohm Nov 3, 2016
255d325
DATAMONGO-1502 - Updated changelog.
odrotbohm Nov 3, 2016
ea9b402
DATAMONGO-1525 - Improved creation of empty collections, esp. EnumSet.
odrotbohm Nov 7, 2016
da5289f
DATAMONGO-1448 - Prepare 2.0 development.
mp911de Jun 9, 2016
4371760
DATAMONGO-1461 - Upgrade Hibernate/Validator/JPA dependencies to matc…
mp911de Jul 12, 2016
30b7b40
DATAMONGO-1176 - Switch to new mongo-java-driver API.
christophstrobl Apr 5, 2016
96eb2b3
DATAMONGO-1176 - Switch to Document API.
christophstrobl Apr 4, 2016
ac9e9ea
DATAMONGO-1176 - Polishing.
mp911de Jun 13, 2016
b9e02b2
DATAMONGO-1176 - Cleanup.
christophstrobl Oct 28, 2016
5610077
DATAMONGO-1176 - Cleanup.
mp911de Nov 3, 2016
4732e2a
DATAMONGO-1176 - Test code cleanup.
mp911de Nov 4, 2016
c5ac30d
DATAMONGO-1444 - Investigate reactive support in Spring Data MongoDB.
mp911de Jun 1, 2016
e021678
DATAMONGO-1444 - Add support for RxJava wrapper types and slice queries.
mp911de Mar 3, 2016
0f96a88
DATAMONGO-1444 - Polishing.
christophstrobl Oct 28, 2016
9ab9621
DATAMONGO-1444 - Adopt changes in Spring Data Commons.
christophstrobl Nov 7, 2016
8f75faf
DATAMONGO-1444 - Update bulk insert operations.
christophstrobl Nov 7, 2016
0711607
DATAMONGO-1444 - Make Project Reactor dependency no longer required f…
mp911de Nov 8, 2016
d69cbda
DATAMONGO-1444 - Polishing.
odrotbohm Nov 13, 2016
1c77a64
DATAMONGO-1444 - Adapt to new changes in reactive repository configur…
odrotbohm Nov 14, 2016
d952a65
DATAMONGO-1444 - Moved to new base class for reactive repository fact…
odrotbohm Nov 14, 2016
655dea4
DATAMONGO-1444 - Accept Collection and subtypes in ReactiveMongoOpera…
mp911de Nov 14, 2016
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DATAMONGO-1500 - Fix JSON serialization error in derived queries with…
… field spec. We now make sure not to eagerly attempt to convert given query parameters into a mongo specific format by calling toString() the query object, but rather delegate this to another step later in the chain. Original pull request: #404.
  • Loading branch information
christophstrobl authored and odrotbohm committed Nov 3, 2016
commit 2ae75a4ff993312489ca415c1c3a7501e33959d8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,6 +15,8 @@
*/
package org.springframework.data.mongodb.repository.query;

import com.mongodb.DBObject;
import com.mongodb.util.JSON;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.MongoTemplate;
Expand Down Expand Up @@ -110,7 +112,7 @@ protected Query createQuery(ConvertingParameterAccessor accessor) {

try {

BasicQuery result = new BasicQuery(query.getQueryObject().toString(), fieldSpec);
BasicQuery result = new BasicQuery(query.getQueryObject(), (DBObject) JSON.parse(fieldSpec));
result.setSortObject(query.getSortObject());

return result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,7 @@
import static org.springframework.data.mongodb.core.query.IsTextQuery.*;

import java.lang.reflect.Method;
import java.util.List;

import org.junit.Before;
import org.junit.Rule;
Expand All @@ -40,6 +41,7 @@
import org.springframework.data.mongodb.core.query.TextCriteria;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Person;
import org.springframework.data.mongodb.repository.Person.Sex;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.projection.ProjectionFactory;
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
Expand Down Expand Up @@ -192,6 +194,18 @@ public void usesDynamicProjection() {
assertThat(fields.get("age"), is((Object) 1));
}

/**
* @see DATAMONGO-1500
*/
@Test
public void shouldLeaveParameterConversionToQueryMapper() {

org.springframework.data.mongodb.core.query.Query query = deriveQueryFromMethod("findBySex", Sex.FEMALE);

assertThat(query.getQueryObject().get("sex"), is((Object) Sex.FEMALE));
assertThat(query.getFieldsObject().get("firstname"), is((Object) 1));
}

private org.springframework.data.mongodb.core.query.Query deriveQueryFromMethod(String method, Object... args) {

Class<?>[] types = new Class<?>[args.length];
Expand Down Expand Up @@ -249,6 +263,9 @@ interface Repo extends MongoRepository<Person, Long> {
PersonDto findPersonDtoByAge(Integer age);

<T> T findDynamicallyProjectedBy(Class<T> type);

@Query(fields = "{ 'firstname' : 1 }")
List<Person> findBySex(Sex sex);
}

interface PersonProjection {
Expand Down