Skip to content

filter expression with or? #640

Closed
@rhuang

Description

I want to query against an index but also apply a filter expression with contains and or. Is this supported in Dynamoid? I don't think I can find any examples within the code.

This is what I want to do:

query_params = {
  table_name: 'table_name',
  index_name: 'some-index,
  select: 'ALL_ATTRIBUTES',
  expression_attribute_values: {
    ':name_search1' => 'johnny',
    ':name_search2' => 'jane',
    ':user_id' => '1234567890'
  },
  key_condition_expression: 'user_id = :user_id',
  filter_expression: 'contains(name_search, :name_search1) or contains(name_search, :name_search2)',
  scan_index_forward: false
}

results = Aws::DynamoDB::Client.new(region: 'us-east-1').query(query_params)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions