## generated
## Doc: Find a valid document by _id

--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_doc_simple.xpl
## Test data

-->stmtadmin create_collection	{"schema":"xtest","name":"mycoll"}
-->recvresult

-->sql
use xtest;
insert into mycoll (doc) values ('{"_id": "1", "name": "Joe1"}');
insert into mycoll (doc) values ('{"_id": "2", "name": "Joe2", "last_name": "Smith"}');
insert into mycoll (doc) values ('{"_id": "3", "name": "Joe2", "last_name": "Shmo"}');
insert into mycoll (doc) values ('{"_id": "4", "name": "小島", "last_name": "Bla"}');
-->endsql

Mysqlx.Crud.Find {
  collection {
    name: "mycoll"
    schema: "xtest"
  }
  data_model: DOCUMENT
}

## expect Mysqlx.Resultset.ColumnMetaData
-->recv
## expect Mysqlx.Resultset.Row
-->recv
## expect Mysqlx.Resultset.Row
-->recv
## expect Mysqlx.Resultset.Row
-->recv
## expect Mysqlx.Resultset.Row
-->recv
## expect Mysqlx.Resultset.FetchDone
-->recv
## expect Mysqlx.Sql.StmtExecuteOk
-->recv

-->title .set empty document and array
Mysqlx.Crud.Update {
  collection {
    name: "mycoll"
    schema: "xtest"
  }
  data_model: DOCUMENT
  operation {
    source {
      document_path {
        type: MEMBER
        value: "docfield"
      }
    }
    operation: ITEM_SET
    value {
      type: OBJECT
      object {
      }
    }
  }
  operation {
    source {
      document_path {
        type: MEMBER
        value: "docarray"
      }
    }
    operation: ITEM_SET
    value {
      type: ARRAY
      array {
      }
    }
  }
}
-->recvresult
EOF

--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/find_doc_simple.xpl 2>&1

## Cleanup
--source ../include/xplugin_cleanup.inc
