Re: world_x
Posted by: Christian Soutou
Date: August 28, 2016 04:24AM

OK Andrzej

I read in the doc about collection

"Each document requires an identifier field called _id.
The value of the _id field must be unique among all documents in the same collection..."

So why after creating the two following tables which seems the same :

-------
DROP DATABASE bd_json;
CREATE DATABASE bd_json;

CREATE TABLE bd_json.tab_vol_json
(details_vol JSON DEFAULT NULL,
_id VARCHAR(32) GENERATED ALWAYS AS
(JSON_UNQUOTE(JSON_EXTRACT(details_vol, '$._id')))
STORED PRIMARY KEY)
ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `bd_json`.`tab_vol_json2` (
`doc` json DEFAULT NULL,
`_id` varchar(32) GENERATED ALWAYS AS
(json_unquote(json_extract(doc, '$._id')))
STORED PRIMARY KEY )
ENGINE=InnoDB DEFAULT CHARSET=utf8;
---------

The mysqlsh returns only one collection and table ?

--------------
mysql-js> db.getCollections()
[
<Collection:tab_vol_json2>
]
mysql-js> db.getTables()
[
<Table:tab_vol_json>
]
----------------
Regards

Options: ReplyQuote


Subject
Views
Written By
Posted
1350
August 25, 2016 03:51AM
916
August 26, 2016 05:51AM
918
August 26, 2016 08:43AM
869
August 26, 2016 01:18PM
Re: world_x
808
August 28, 2016 04:24AM
760
August 28, 2016 08:45AM
799
August 28, 2016 10:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.