Debian Codegraph @

mysql-test/suite/x/t/find_doc_simple.test

raw
1 ## generated
2 ## Doc: Find a valid document by _id
3
4 --source include/xplugin_preamble.inc
5 --source include/xplugin_create_user.inc
6
7 create schema xtest default charset 'utf8mb4';
8
9 ## Test starts here
10 --write_file $MYSQL_TMP_DIR/find_doc_simple.xpl
11 ## Test data
12
13 -->stmtadmin create_collection {"schema":"xtest","name":"mycoll"}
14 -->recvresult
15
16 -->sql
17 use xtest;
18 insert into mycoll (doc) values ('{"_id": "1", "name": "Joe1"}');
19 insert into mycoll (doc) values ('{"_id": "2", "name": "Joe2", "last_name": "Smith"}');
20 insert into mycoll (doc) values ('{"_id": "3", "name": "Joe2", "last_name": "Shmo"}');
21 insert into mycoll (doc) values ('{"_id": "4", "name": "小島", "last_name": "Bla"}');
22 -->endsql
23
24 Mysqlx.Crud.Find {
25 collection {
26 name: "mycoll"
27 schema: "xtest"
28 }
29 data_model: DOCUMENT
30 }
31
32 ## expect Mysqlx.Resultset.ColumnMetaData
33 -->recv
34 ## expect Mysqlx.Resultset.Row
35 -->recv
36 ## expect Mysqlx.Resultset.Row
37 -->recv
38 ## expect Mysqlx.Resultset.Row
39 -->recv
40 ## expect Mysqlx.Resultset.Row
41 -->recv
42 ## expect Mysqlx.Resultset.FetchDone
43 -->recv
44 ## expect Mysqlx.Sql.StmtExecuteOk
45 -->recv
46
47 -->title .set empty document and array
48 Mysqlx.Crud.Update {
49 collection {
50 name: "mycoll"
51 schema: "xtest"
52 }
53 data_model: DOCUMENT
54 operation {
55 source {
56 document_path {
57 type: MEMBER
58 value: "docfield"
59 }
60 }
61 operation: ITEM_SET
62 value {
63 type: OBJECT
64 object {
65 }
66 }
67 }
68 operation {
69 source {
70 document_path {
71 type: MEMBER
72 value: "docarray"
73 }
74 }
75 operation: ITEM_SET
76 value {
77 type: ARRAY
78 array {
79 }
80 }
81 }
82 }
83 -->recvresult
84 EOF
85
86 --exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/find_doc_simple.xpl 2>&1
87
88 ## Cleanup
89 --source ../include/xplugin_cleanup.inc