diff --git a/src/query/expression.spec.ts b/src/query/expression.spec.ts index 6141002..7a4b5c4 100644 --- a/src/query/expression.spec.ts +++ b/src/query/expression.spec.ts @@ -253,6 +253,21 @@ describe('query/expression', () => { ':v1': { BOOL: true }, }, }) + + expect(buildQueryExpression(schema, { + someString: ['not contains', 'hello world'], + someBool: true, + })).to.deep.equal({ + FilterExpression: 'not contains(#a0, :v0) AND #a1 = :v1', + ExpressionAttributeNames: { + '#a0': 'someString', + '#a1': 'someBool', + }, + ExpressionAttributeValues: { + ':v0': { S: 'hello world' }, + ':v1': { BOOL: true }, + }, + }) }) it('works with includes/IN operator', () => { diff --git a/src/query/expression.ts b/src/query/expression.ts index aa8bff0..283db5f 100644 --- a/src/query/expression.ts +++ b/src/query/expression.ts @@ -262,7 +262,7 @@ class FilterExpressionQuery { strValue = { B: _.isArray(strValue.BS) ? strValue.BS[0] : strValue.BS } } - const queryOperator = operator === 'beginsWith' ? 'begins_with' : operator.replace(/ /g, '_') + const queryOperator = operator === 'beginsWith' ? 'begins_with' : operator query = `${queryOperator}(${attrNameMappedTo}, ${variableName})` values[variableName] = strValue break