Skip to content

Ability to apply filter expressions to Query for Numbers and Boolean fields #262

Open
@adarshhm6

Description

@adarshhm6

With Reference to
#27 and
https://github.com/boostchicken/spring-data-dynamodb/wiki/Change-Log

We now have an option to filter the Query Result using filterExpression as below.

With static parameters

@query(fields = "leaveDate", limit = 1, filterExpression = "contains(#field, :value)",
expressionMappingNames = {@ExpressionAttribute(key = "#field", value = "name")},
expressionMappingValues = {@ExpressionAttribute(key=":value", value = "projection")})
List findByPostCode(String postCode);

With dynamic parameters from methods

@Query(fields = "leaveDate", limit = 1, filterExpression = "contains(#field, :value)",
		expressionMappingNames = {@ExpressionAttribute(key = "#field", value = "name")},
		expressionMappingValues = {@ExpressionAttribute(key=":value", parameterName = "projection")})
List<User> findByPostCode(@Param("postCode") String postCode, @Param("projection") String projection);

But Is there any option or feature available to filter the result based on a field which is of Type Number and Boolean.
Let's say In Table I have Price column of type Number and I want to filter the final result based on Price >=100.
Then how can we achieve it with filterExpression as ExpressionAttribute has only key, value and parameterName which all are of type String.

Specifications

  • Spring Data DynamoDB Version: 5.2.5
  • Spring Data Version: 2.2.4.RELEASE
  • AWS SDK Version: 1.11.771
  • Java Version: 8
  • Platform Details: Windows 10

All those information are logged by org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory on INFO level on startup.
Or use java -version and mvn dependency:tree | grep -E 'spring|aws' to provide those version numbers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions