671 lines
16 KiB
Plaintext
671 lines
16 KiB
Plaintext
CREATE SCHEMA xtest;
|
|
|
|
Data model: TABLE
|
|
=================
|
|
|
|
0 rows affected
|
|
|
|
Insert two docs
|
|
---------------
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Upsert one doc
|
|
--------------
|
|
Got expected error: Unable update on duplicate key for TABLE data model (code 5014)
|
|
|
|
Data model: DOCUMENT
|
|
====================
|
|
|
|
Test0 - No matches
|
|
------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "3", "name": "foo", "email": "foo@ora.com"}
|
|
0 rows affected
|
|
|
|
Test1 - Match on _id
|
|
--------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@ora.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test2 - Match on secondary key only
|
|
-----------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
Got expected error: Unable upsert data in document collection 'col2' (code 5018)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test3 - Match on _id only, missing secondary index
|
|
--------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "bla"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test4 - Match on _id and secondary, but from different rows
|
|
-----------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test5 - Match on _id and secondary key (other field value updated)
|
|
------------------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "bla", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test6 - New unique document, with null on secondary key
|
|
-------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "bla", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "3", "name": "bla", "email": null}
|
|
0 rows affected
|
|
|
|
Test7 - New unique document, with missing field on secondary key
|
|
----------------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "3", "name": "bla"}
|
|
0 rows affected
|
|
|
|
Test8 - Match on _id only, null at secondary index
|
|
--------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "bla", "email": null}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test9 - Match on _id and null value at secondary index
|
|
------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "bla"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "3", "name": "bla"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "bla"}
|
|
{"_id": "2", "name": "foo"}
|
|
{"_id": "3", "name": "bla"}
|
|
0 rows affected
|
|
|
|
Test10 - No match, null value at secondary index
|
|
------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "bla"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "3", "name": "bla"}
|
|
0 rows affected
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "bla"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "3", "name": "bla"}
|
|
{"_id": "4", "name": "foo"}
|
|
0 rows affected
|
|
|
|
Test1-2 - Match on _id and secondary key (upsert two rows)
|
|
----------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
3 rows affected
|
|
Records: 2 Duplicates: 1 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@ora.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "4", "name": "bla", "email": "bla@bla.com"}
|
|
0 rows affected
|
|
|
|
Test2-2 - Match on secondary key only (upsert two rows)
|
|
-------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
Got expected error: Unable upsert data in document collection 'col22' (code 5018)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test3-2 - Match on _id only (upsert two rows)
|
|
---------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
3 rows affected
|
|
Records: 2 Duplicates: 1 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "bla"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "4", "name": "bla", "email": "bla@bla.com"}
|
|
0 rows affected
|
|
|
|
Test4-2 - Match on _id and secondary, but from different rows (upsert two rows)
|
|
-------------------------------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test0-3 - No matches (insert instead upsert)
|
|
--------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "3", "name": "foo", "email": "foo@ora.com"}
|
|
0 rows affected
|
|
|
|
Test1-3 - Match on _id and secondary key (insert instead upsert)
|
|
----------------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test2-3 - Match on secondary key only (insert instead upsert)
|
|
-------------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test3-3 - Match on _id only (insert instead upsert)
|
|
---------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test4-3 - Match on _id and secondary, but from different rows (insert instead upsert)
|
|
-------------------------------------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test0-4 - No matches (drop _id column)
|
|
--------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "3", "name": "foo", "email": "foo@ora.com"}
|
|
0 rows affected
|
|
|
|
Test1-4 - Match on _id and secondary key (drop _id coulmn)
|
|
----------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "1", "name": "foo", "email": "foo@ora.com"}
|
|
0 rows affected
|
|
|
|
Test2-4 - Match on secondary key only (drop _id coulmn)
|
|
-------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error: Unable upsert data in document collection 'col42' (code 5018)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
Test3-4 - Match on _id only (drop _id coulmn)
|
|
---------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
{"_id": "1", "name": "bla"}
|
|
0 rows affected
|
|
|
|
Test4-4 - Match on _id and secondary, but from different rows (drop _id coulmn)
|
|
-------------------------------------------------------------------------------
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
Got expected error: Unable upsert data in document collection 'col44' (code 5018)
|
|
doc
|
|
{"_id": "1", "name": "foo", "email": "foo@bar.com"}
|
|
{"_id": "2", "name": "bla", "email": "bla@bar.com"}
|
|
0 rows affected
|
|
Mysqlx.Ok {
|
|
msg: "bye!"
|
|
}
|
|
ok
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
Got expected error: Unable upsert data in document collection 'add_or_replace' (code 5018)
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
|
|
2 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "document_001", "name": "basic"}
|
|
{"_id": "document_002", "name": "advenced"}
|
|
0 rows affected
|
|
Mysqlx.Ok {
|
|
msg: "bye!"
|
|
}
|
|
ok
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
command ok
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
Got expected error: Unable upsert data in document collection 'multi' (code 5018)
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
Got expected error: Unable upsert data in document collection 'multi' (code 5018)
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
Got expected error: Document contains a field value that is not unique but required to be (code 5116)
|
|
doc
|
|
{"_id": "001", "first": "A", "second": "A"}
|
|
{"_id": "002", "first": "B", "second": "B"}
|
|
0 rows affected
|
|
Mysqlx.Ok {
|
|
msg: "bye!"
|
|
}
|
|
ok
|
|
|
|
command ok
|
|
|
|
Numerical _id
|
|
-------------
|
|
|
|
1 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": "123", "first": "A", "second": "A"}
|
|
0 rows affected
|
|
|
|
2 rows affected
|
|
Got expected error (code 0)
|
|
doc
|
|
{"_id": 123, "first": "B", "second": "B"}
|
|
0 rows affected
|
|
Mysqlx.Ok {
|
|
msg: "bye!"
|
|
}
|
|
ok
|
|
DROP SCHEMA IF EXISTS xtest;
|