Re: generated _id by MySQL Server
20.4.3.2 Working with Collections
Each document requires an identifier field called _id.
The value of the _id field must be unique among all documents in the same collection.
In MySQL 8.0.11 and higher, document IDs are generated by the server, not the client,
so MySQL Shell does not automatically set an _id value.
A MySQL server at 8.0.11 or higher sets an _id value if the document does not contain the _id field.
5.1.1 Understanding Document IDs
Whenever an _id field value is not present in an inserted document,
the server generates an _id value. The generated _id value used
for a document is returned to the client as part of the document insert Result message.
1.Document as Collection.
When I use method "add" for insertion information in Collection I don't need insert _id fields(see 20.4.3.2 & 5.1.1).
MySQL server generate _id.
2.Document as Relation Table
When I use method "insert" for insertion information to Collection,unlike the first case MySQL server ask me insert _id.
I want to find out how MySQL server should work or am I mistaken somewhere.
Subject
Views
Written By
Posted
987
January 19, 2020 04:26AM
595
January 19, 2020 12:44PM
Re: generated _id by MySQL Server
812
January 19, 2020 02:06PM
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.