hi:
can't use not_contains in FilterExpression for scan call.
FilterExpression : not_contain(#test1.#test2.#test3,:test3)
the result from remote:
key [ValidationException: Invalid FilterExpression: Invalid function name; function: not_contain
thanks!
Hello @seanchann, thank you for reaching out to us. Can I have a code snippet of what you are trying to do?
var spec = "spec"
var userservice = "userService"
var nodes = "nodes"
type testUser struct {
Nodes map[string]interface{} `json:"nodes"`
}
type testSpec struct {
User testUser `json:"userService"`
}
type test struct {
Spec testSpec `json:"spec"`
}
func scanNotContains(db *dynamodb.DynamoDB) {
filter := "not_contain(#spec.#userService.#nodes, :node1)"
expressionAttrName := map[string]*string{
"#spec": &spec,
"#userservice": &userservice,
"#nodes": &nodes,
}
nodeVal := "test"
expressionAttrValue := map[string]*dynamodb.AttributeValue{
":node1": &dynamodb.AttributeValue{
S: &nodeVal,
},
}
scanParam := &dynamodb.ScanInput{
TableName: aws.String(table),
FilterExpression: aws.String(filter),
ExpressionAttributeNames: expressionAttrName,
ExpressionAttributeValues: expressionAttrValue,
}
output, err := db.Scan(scanParam)
if err != nil {
glog.Errorf(" scan list error %v", err.Error())
}
glog.V(9).Infof("Get query output %+v\r\n", *output.Count)
}
func main() {
sess, err := newDynamodbSession("", "", "", "us-west-2")
if err != nil {
glog.Errorf("dynamodb create seesion error:%v\r\n", err)
}
db := dynamodb.New(sess)
scanNotContains(db)
}
above program not work. error:
ValidationException: Invalid FilterExpression: Invalid function name; function: not_contain
status code: 400, request id: J3ITC142JMGSGDLBGNPPBRMAIFVV4KQNSO5AEMVJF66Q9ASUAAJG
not_contain function not support?
not_contain is not a valid filter expression. Here is a list of them. Your filter should probably be "NOT contains(<some expression>)". Going to close this. If you have any additional issues, please let us know
Most helpful comment
not_containis not a valid filter expression. Here is a list of them. Your filter should probably be"NOT contains(<some expression>)". Going to close this. If you have any additional issues, please let us know