|
|
|
@ -95,13 +95,25 @@ public class MongoQuery implements RepositoryQuery { |
|
|
|
|
|
|
|
|
|
|
|
protected List<?> readCollection(DBObject query) { |
|
|
|
protected List<?> readCollection(DBObject query) { |
|
|
|
|
|
|
|
|
|
|
|
return operations.query(operations.getDefaultCollectionName(), query, |
|
|
|
return operations.query(operations.getDefaultCollectionName(), |
|
|
|
method.getDomainClass()); |
|
|
|
query, method.getDomainClass()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@link Execution} for collection returning queries. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @author Oliver Gierke |
|
|
|
|
|
|
|
*/ |
|
|
|
class CollectionExecution extends Execution { |
|
|
|
class CollectionExecution extends Execution { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* (non-Javadoc) |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @see |
|
|
|
|
|
|
|
* org.springframework.data.document.mongodb.repository.MongoQuery.Execution |
|
|
|
|
|
|
|
* #execute(com.mongodb.DBObject) |
|
|
|
|
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Object execute(DBObject query) { |
|
|
|
public Object execute(DBObject query) { |
|
|
|
|
|
|
|
|
|
|
|
@ -173,11 +185,17 @@ public class MongoQuery implements RepositoryQuery { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class SingleEntityExecution extends Execution { |
|
|
|
class SingleEntityExecution extends Execution { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* (non-Javadoc) |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @see |
|
|
|
|
|
|
|
* org.springframework.data.document.mongodb.repository.MongoQuery.Execution |
|
|
|
|
|
|
|
* #execute(com.mongodb.DBObject) |
|
|
|
|
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
Object execute(DBObject query) { |
|
|
|
Object execute(DBObject query) { |
|
|
|
|
|
|
|
|
|
|
|
List<?> result = readCollection(query); |
|
|
|
List<?> result = readCollection(query); |
|
|
|
|
|
|
|
|
|
|
|
return result.isEmpty() ? null : result.get(0); |
|
|
|
return result.isEmpty() ? null : result.get(0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|