Re: world_x
Posted by: Andrzej Religa
Date: August 26, 2016 01:18PM

Hi Christian,

> --1
>
> In my table the createCollection() methods doesn't
> underneath ?
> Does the virtual column should be added?
>
> CREATE DATABASE bd_json;
>
> CREATE TABLE bd_json.tab_vol_json
> (vol_id INT AUTO_INCREMENT PRIMARY KEY,
> details_vol JSON
> );
>
> /*
> CREATE TABLE `CountryInfo` (
> `doc` json DEFAULT NULL,
> `_id` varchar(32) GENERATED ALWAYS AS
> (json_unquote(json_extract(doc, '$._id'))) STORED
> PRIMARY KEY
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
> */
>

Note that in your case the column names and their definitions/types differ from what's in the example from the world_x script.
That is why you should not try to create the collection 'manually'.
It's good for the scripts that create the schema using SQL.
When you use X Protocol createCollection() method for that you just don't need to worry about such details.


>
> --2
>
> OK if I want create a collection with the name of
> my table :
>
> \use bd_json
>
> mysql-js> db.createCollection("tab_vol_json")
> MySQL Error (1050): Table 'tab_vol_json' already
> exists at (shell):1:3
> in db.createCollection("tab_vol_json")
>
> and db.getCollections() returns nothing.

That's because both tables and collections are in the same namespace and their names have to be unique.
You already created table 'tabl_vol_json' manually so you can't use this name for the collection.
You need either drop your table first or pick another name for the collection.

Hope it helps.

--
Andrzej Religa
MySQL Developer Tools

Options: ReplyQuote


Subject
Views
Written By
Posted
1305
August 25, 2016 03:51AM
883
August 26, 2016 05:51AM
885
August 26, 2016 08:43AM
Re: world_x
836
August 26, 2016 01:18PM
777
August 28, 2016 04:24AM
738
August 28, 2016 08:45AM
770
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.