polardbxengine/mysql-test/suite/x/t/find_docpath_expr.test

72 lines
2.7 KiB
Plaintext

## generated
## Doc: Find using complex docpaths in expression
--source include/xplugin_preamble.inc
--source include/xplugin_create_user.inc
create schema xtest default charset 'utf8mb4';
## Test starts here
--write_file $MYSQL_TMP_DIR/find_docpath_expr.tmp
## Test data
-->stmtadmin create_collection {"schema":"xtest","name":"fancycoll"}
-->recvresult
-->sql
use xtest;
insert into fancycoll (doc) values ('\n{\n \"_id\": \"X999_Y999\",\n \"from\": {\n \"name\": \"Tom Brady\", \"id\": \"X12\"\n },\n \"message\": \"Looking forward to 2010!\",\n \"actions\": [\n {\n \"name\": \"Comment\",\n \"link\": \"http://www.facebook.com/X999/posts/Y999\"\n },\n {\n \"name\": \"Like\",\n \"link\": \"http://www.facebook.com/X999/posts/Y999\"\n }\n ],\n \"type\": \"status\",\n \"created_time\": \"2010-08-02T21:27:44+0000\",\n \"updated_time\": \"2010-08-02T21:27:44+0000\"\n }\n');
insert into fancycoll (doc) values ('\n{\n \"_id\": \"X999_Y998\",\n \"from\": {\n \"name\": \"Dom Crady\", \"id\": \"A12\"\n },\n \"message\": \"Looking forward to 2034!\",\n \"actions\": [\n {\n \"name\": \"Comment\",\n \"link\": \"http://www.facebook.com/X999/posts/Y222\"\n },\n {\n \"name\": \"Like\",\n \"link\": \"http://www.facebook.com/X999/posts/Y222\"\n }\n ],\n \"type\": \"status\",\n \"created_time\": \"2011-08-02T21:27:44+0000\",\n \"updated_time\": \"2011-08-02T21:27:44+0000\"\n }\n');
-->endsql
Mysqlx.Crud.Find {
collection {
name: "fancycoll"
schema: "xtest"
}
data_model: DOCUMENT
criteria {
type: OPERATOR
operator {
name: "!="
param {
type: IDENT
identifier {
document_path {
type: MEMBER
value: "from"
}
document_path {
type: MEMBER
value: "id"
}
}
}
param {
type: LITERAL
literal {
type: V_OCTETS
v_octets {value:"X12"}
}
}
}
}
}
## expect Mysqlx.Resultset.ColumnMetaData
-->recv
## expect Mysqlx.Resultset.Row
-->recv
## expect Mysqlx.Resultset.FetchDone
-->recv
## expect Mysqlx.Sql.StmtExecuteOk
-->recv
EOF
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/find_docpath_expr.tmp 2>&1
## Cleanup
drop schema if exists xtest;
--remove_file $MYSQL_TMP_DIR/find_docpath_expr.tmp
--source include/xplugin_drop_user.inc