config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/x/r/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/x/r/crud_doc_expr_object.result

install plugin mysqlx soname "mysqlx.so";
call mtr.add_suppression("Plugin mysqlx reported: .Failed at SSL configuration: .SSL context is not usable without certificate and private key..");
call mtr.add_suppression("Plugin mysqlx reported: .SSL_CTX_load_verify_locations failed.");
RUN DROP SCHEMA IF EXISTS xtest

0 rows affected
RUN CREATE SCHEMA xtest

1 rows affected
RUN CREATE TABLE xtest.xcoll (doc JSON, _id VARBINARY(16) GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(doc, '$._id'))) STORED PRIMARY KEY)

0 rows affected
Inserting object into collection
send Mysqlx.Crud.Insert {
  collection {
    name: "xcoll"
    schema: "xtest"
  }
  data_model: DOCUMENT
  row {
    field {
      type: OBJECT
      object {
        fld {
          key: "_id"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "1"
              }
            }
          }
        }
        fld {
          key: "first_name"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "John"
              }
            }
          }
        }
        fld {
          key: "last_name"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "Snow"
              }
            }
          }
        }
      }
    }
  }
}


1 rows affected
RUN SELECT * FROM xtest.xcoll
doc	_id
{"_id": "1", "last_name": "Snow", "first_name": "John"}	1
0 rows affected
Selecting object from collection
send Mysqlx.Crud.Find {
  collection {
    name: "xcoll"
    schema: "xtest"
  }
  data_model: DOCUMENT
  projection {
    source {
      type: OBJECT
      object {
        fld {
          key: "name"
          value {
            type: FUNC_CALL
            function_call {
              name {
                name: "concat"
              }
              param {
                type: IDENT
                identifier {
                  document_path {
                    type: MEMBER
                    value: "first_name"
                  }
                }
              }
              param {
                type: LITERAL
                literal {
                  type: V_OCTETS
                  v_octets {
                    value: " "
                  }
                }
              }
              param {
                type: IDENT
                identifier {
                  document_path {
                    type: MEMBER
                    value: "last_name"
                  }
                }
              }
            }
          }
        }
        fld {
          key: "number"
          value {
            type: OPERATOR
            operator {
              name: "+"
              param {
                type: LITERAL
                literal {
                  type: V_SINT
                  v_signed_int: 1
                }
              }
              param {
                type: LITERAL
                literal {
                  type: V_SINT
                  v_signed_int: 1
                }
              }
            }
          }
        }
      }
    }
  }
}

doc
{"name": "John Snow", "number": 2}
command ok
Selecting object from collection with alias
send Mysqlx.Crud.Find {
  collection {
    name: "xcoll"
    schema: "xtest"
  }
  data_model: DOCUMENT
  projection {
    source {
      type: OBJECT
      object {
        fld {
          key: "name"
          value {
            type: FUNC_CALL
            function_call {
              name {
                name: "concat"
              }
              param {
                type: IDENT
                identifier {
                  document_path {
                    type: MEMBER
                    value: "first_name"
                  }
                }
              }
              param {
                type: LITERAL
                literal {
                  type: V_OCTETS
                  v_octets {
                    value: " "
                  }
                }
              }
              param {
                type: IDENT
                identifier {
                  document_path {
                    type: MEMBER
                    value: "last_name"
                  }
                }
              }
            }
          }
        }
      }
    }
    alias: "hero"
  }
}

doc
{"hero": {"name": "John Snow"}}
command ok
Selecting object with sub-object from collection
send Mysqlx.Crud.Find {
  collection {
    name: "xcoll"
    schema: "xtest"
  }
  data_model: DOCUMENT
  projection {
    source {
      type: OBJECT
      object {
        fld {
          key: "name"
          value {
            type: FUNC_CALL
            function_call {
              name {
                name: "concat"
              }
              param {
                type: IDENT
                identifier {
                  document_path {
                    type: MEMBER
                    value: "first_name"
                  }
                }
              }
              param {
                type: LITERAL
                literal {
                  type: V_OCTETS
                  v_octets {
                    value: " "
                  }
                }
              }
              param {
                type: IDENT
                identifier {
                  document_path {
                    type: MEMBER
                    value: "last_name"
                  }
                }
              }
            }
          }
        }
        fld {
          key: "detail"
          value {
            type: OBJECT
            object {
              fld {
                key: "first"
                value {
                  type: IDENT
                  identifier {
                    document_path {
                      type: MEMBER
                      value: "first_name"
                    }
                  }
                }
              }
              fld {
                key: "last"
                value {
                  type: IDENT
                  identifier {
                    document_path {
                      type: MEMBER
                      value: "last_name"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

doc
{"name": "John Snow", "detail": {"last": "Snow", "first": "John"}}
command ok
Updating collection by object
send Mysqlx.Crud.Update {
  collection {
    name: "xcoll"
    schema: "xtest"
  }
  data_model: DOCUMENT
  operation {
    source {
      document_path {
        type: MEMBER
        value: "occupation"
      }
    }
    operation: ITEM_SET
    value {
      type: OBJECT
      object {
        fld {
          key: "location"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "the wall"
              }
            }
          }
        }
        fld {
          key: "title"
          value {
            type: LITERAL
            literal {
              type: V_OCTETS
              v_octets {
                value: "lord commander"
              }
            }
          }
        }
      }
    }
  }
}


1 rows affected
Rows matched: 1  Changed: 1  Warnings: 0
RUN SELECT * FROM xtest.xcoll
doc	_id
{"_id": "1", "last_name": "Snow", "first_name": "John", "occupation": {"title": "lord commander", "location": "the wall"}}	1
0 rows affected
NOT Error: empty object
send Mysqlx.Crud.Find {
  collection {
    name: "xcoll"
    schema: "xtest"
  }
  data_model: DOCUMENT
  projection {
    source {
      type: OBJECT
      object {
      }
    }
  }
}

doc
{}
command ok
Error: empty object key
send Mysqlx.Crud.Find {
  collection {
    name: "xcoll"
    schema: "xtest"
  }
  data_model: DOCUMENT
  projection {
    source {
      type: OBJECT
      object {
        fld {
          key: ""
          value {
            type: IDENT
            identifier {
              document_path {
                type: MEMBER
                value: "first_name"
              }
            }
          }
        }
      }
    }
  }
}

Got expected error:
Mysqlx.Error {
  severity: ERROR
  code: 5154
  msg: "Invalid key for Mysqlx::Expr::Object"
  sql_state: "HY000"
}

RUN drop schema if exists xtest

1 rows affected
Mysqlx.Ok {
  msg: "bye!"
}
ok
uninstall plugin mysqlx;

Man Man