You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which is incorrect. As a result the filter will not work and all subscribers will receive the message.
Nested filters have to be written like this:
{TableName: "graphql_subscriptions",IndexName: "TopicIndex",ExpressionAttributeNames: {"#hashKey": "topic","#filter": "filter","#0": "update","#1": "userId"// split the key by "."},ExpressionAttributeValues: {":hashKey": "onUserBadgeCountChange",":0": "foo",},KeyConditionExpression: "#hashKey = :hashKey",FilterExpression: "(#filter.#0.#1 = :0 OR attribute_not_exists(#filter.#0.#1))",// Join the key back together with #0.#1}
A very early draft of a solution inside getFilteredSubs.ts looks like this:
for(const[key,value]ofObject.entries(flattenPayload)){constaliasNumber=attributeCounter++;letsubAliasNumbers=[];letsubAliasNumber=aliasNumber;for(constpartofkey.split('.')){expressionAttributeNames[`#${subAliasNumber}`]=part;subAliasNumbers.push(subAliasNumber);subAliasNumber++;}expressionAttributeValues[`:${aliasNumber}`]=value;filterExpressions.push(`(#filter.${subAliasNumbers.map(n=>`#${n}`).join('.')} = :${aliasNumber} OR attribute_not_exists(#filter.${subAliasNumbers.map(n=>`#${n}`).join('.')})`);}
Unfortunetaly the docs are misleading as well - nested values are clearly described as "working fine" when not working at all.
The text was updated successfully, but these errors were encountered:
Assume a filter:
Which will be converted to the dynamodb query:
Which is incorrect. As a result the filter will not work and all subscribers will receive the message.
Nested filters have to be written like this:
A very early draft of a solution inside getFilteredSubs.ts looks like this:
Unfortunetaly the docs are misleading as well - nested values are clearly described as "working fine" when not working at all.
The text was updated successfully, but these errors were encountered: